Quantcast
Channel: Sed not outputting matches from regex to file - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 4 View Live

Answer by choroba for Sed not outputting matches from regex to file

You can tell sed to only print if the substitution was successful. Use the t command for that: it goes to the specified label if it was. b skips the rest of the code, p prints the replaced line. sed -n...

View Article


Answer by pLumo for Sed not outputting matches from regex to file

You're sed command is not supposed to output the matches only. s/pattern/replacement/g just replaces the pattern with the replacement, everything else is untouched. Actually, the output should not be...

View Article


Answer by L. Scott Johnson for Sed not outputting matches from regex to file

Use -n to only show matching lines. sed -n -r 's/([-A-Z0-9]+)"/\1/g' data.txt > clean.txt and for the second question, replace the things you don't want with nothing: sed -n -r...

View Article

Sed not outputting matches from regex to file

I have a file (data.txt) which contains strings like this: [?1h= => ["AD070517", "AD070518", : ESCESCOOBB "AD070809", "NE0000013", "NE0000014", : ESCESC[[66~~ "LG100085-097", "LG100085-098", ] I am...

View Article
Browsing latest articles
Browse All 4 View Live