bash - Printing lines in which atleast one assignment operator(=) even if a conditional operator(==) exits in that line -


in unix scripting

i have file has lines follows:

if(a==b || b=c && c==d) if(a!=b) if(a=b) 

i have print lines having assignment operator i.e

if(a==b || b=c && c==d) , if(a=b) 

anybody pls help


so you're looking (simplistically) = on own, no other = abutting it. can done regex [^=]=[^=] (an = other = on both sides).

unfortunately, capture things != or >= may want expand bit. start:

grep '[^!<>=]=[^=]' inputfile 

that should catch vast majority although you're in same boat want process xml regexes rather xml processor - there edge case don't because regex far simpler tool language parser. however, stated, should fine weirdest of edge cases.

and may still have handle cases (for example) = may @ start or end of line pretty unlikely since coder formatting code insane :-)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -