Reputation: 111
I have two special characters,i want get the content of between them in shell.
Don't use awk ,because my linux can't find awk.
Upvotes: 0
Views: 17435
Reputation: 41
echo "This is a #TEST%" | grep -o \#[a-zA-Z.0-9]*\%
will yield
#TEST%
You can also strip the special characters using sed..
echo "This is a #TEST%" | grep -o \#[a-zA-Z.0-9]*\% | sed 's/#//g' | sed 's/%//g'
to yield
TEST
Upvotes: 3
Reputation: 111
$ sed -n '/WORD1/,/WORD2/p' /path/to/file
$ sed -n '/FOO/,/BAR/p' test.txt
Upvotes: 2