sharong
1
[LEFT]Hi
I am trying to run CMD that combining EGREP and PERL in multiple files
cat *07:00.22-12-13.txt | egrep" NAME| perl -ne 'print if /^sid9/ .. /^!/' "
[/LEFT]
[LEFT]I need the see the NAME and the text from sid9 to !
how can I use the EGERP in parallel to the PERL ?[/LEFT]
[LEFT]
This is one file
Qqq
www
eee
NAME
sid9
a
b
!
Aaa
Bbb
Ccc
The output is
NAME
sid9
a
b
!
Thanks
Sharon[/LEFT]
Try:
perl -ne 'print if /^NAME/ || /^sid9/ .. /^!/ ' file
or
awk '/^NAME/ || /^sid9/,/^!/' file
1 Like
Hello,
Following awk
may also help.
awk -vs1="NAME" -vs2="!" 'NR==FNR{a[$1];next} ($1 in a){if($1==s1) f=1} f{print} ($1==s2) {f=0}' check_count_check_text1211 check_count_check_text1211
Output will be as follows.
NAME
sid9
a
b
!
NOTE: where check_count_check_text1211 is the Input file name.
Thanks,
R. Singh
1 Like