awk: warning: escape sequence '\<' treated as plain '>'

Posted on in Categories last updated September 29, 2012

I‘m trying to match words using GNU awk command and getting the following error:

echo 'foo bar this that blah' | awk '{gsub("\<regex-word\>", "NEW-WORD");print}'

But getting the following warning on screen and it is not working:
awk: warning: escape sequence `\<' treated as plain `<' awk: warning: escape sequence `\>' treated as plain `>'

How do I fix this problem under Unix like operating systems?

Linux / Unix sed: Delete Word From File / Input

Posted on in Categories last updated September 15, 2012

I‘ve a file as follows:

This is a test.
One bang two three
Foo dang Bar
001 0xfg 0xA
002 0xA foo bar 0xfG
I'm done

How do I delete all “words” from the above file which ends with a particular letter (say ‘g’) in each line? The output should be as follows:

This is a test.
One two three
Foo Bar
001 0xA
002 0xA foo bar
I'm done

How do I delete regex-based word using sed or awk under Linux / Unix like operating systems?

awk / cut: Skip First Two Fields and Print the Rest of Line

Posted on in Categories , , , , last updated December 21, 2016

I would like to skip first two or three fields at the the beginning of a line and print the rest of line. Consider the following input
    This is a test
    Giving back more than we take

I want my input file with the following output:
    a test
    more than we take

How do I printing lines from the nth field using awk under UNIX or Linux operating systems?