Hi,
Could someone help me in figuring out a way using which i can search for a specific pattern.
Eg. JUSTDOIT..I have to print just the word "DO" from "JUSTDOIT"
If the same word JUSTDOIT is print n number of times
Hi,
Could someone help me in figuring out a way using which i can search for a specific pattern.
Eg. JUSTDOIT..I have to print just the word "DO" from "JUSTDOIT"
If the same word JUSTDOIT is print n number of times
grep -o "DO"
Thanks mate but my bad that I was not clear with my query.
the word JUSTDOIT is like repeated 10 times and then the word "DO" changes to a number(5.24) so in other words I need to get the value which is always there between JUST and IT..It could be a number or character or any special character.
]$ cat test_file_tmp
JUST25IT
JUSTDOIT
JUST**IT
JUSTDOIT
JUSTUHIT
JUSTOP
]$ cat test_file_tmp | grep -0 "JUST*" | grep "IT$" | awk -F "JUST|IT" '{ print $2 }'
25
DO
**
DO
UH
Thanks pamu that works just fine..and any idea how i can tackle this.
allthe123.L4best is the value and just get 123.L4 to be printed.
You can use the same logic here too...
You don't need so many commands in a pipeline...
sed -n '/JUST\(.*\)IT/s//\1/p' inputfile
Just adapt this solution to your other similar requirement...