Search Results

Search: Posts Made By: kittiwas
2,529
Posted By rdcwayx
awk '/1H1A/{str=$0}/5R0RECEIPT/&&str!=""{print...
awk '/1H1A/{str=$0}/5R0RECEIPT/&&str!=""{print str;str=""}' infile
1,877
Posted By pravin27
try this, perl -nle...
try this,
perl -nle 'if(/1H1XXXXX\|(0001|0002|0003)\|(Y|N)/){print;$flg=1;next}if($flg && $_!~ /^1H1XXXXX/){print} else {$flg=0}' data.txt
2,807
Posted By durden_tyler
And yet another Perl script - $ $ $...
And yet another Perl script -


$
$
$ cat f33
START
NO 0001/01
HEAD AAAA
BODY1 AAA
TAIL AAA
END
START
NO 0001/03
HEAD AAAA
BODY1 AAA
BODY2 AAA
TAIL AAA
END
START
2,807
Posted By Klashxx
A perl one: perl -ne...
A perl one:

perl -ne '$a=$a.$_;if(/^START/){$a=$_;$i=1}if(/NO 0003\/02/){$p=1};if (/^END/ && $i && $p){print $a;$p=0}' infile
2,807
Posted By k_manimuthu
perl -lne '$/="END";print $_."END" if /0003\/02/'...
perl -lne '$/="END";print $_."END" if /0003\/02/' file

For the above code END matches with SUBEND

So you add carriage return (\n) in your code

perl -lne '$/="\nEND";print $_."\nEND" if...
2,807
Posted By rdcwayx
in solaris, use nawk or /usr/xpg4/bin/awk
in solaris, use nawk or /usr/xpg4/bin/awk
1,401
Posted By pritish.sas
You want to repalce 0001 in the begging or...
You want to repalce 0001 in the begging or anywhere. Please be specific

you can use sed or tr command to achive this. Otherwise you will write a perl program for the same
1,401
Posted By pravin27
Hi, Try this... #!/bin/sh ...
Hi,

Try this...


#!/bin/sh

file_to_search=file.txt
original_file=$file_to_search

cp $original_file newfile
for da_b in $(cat /test/input.txt)
do
sed "s/Event: \"${da_b}\"/Event:...
1,401
Posted By danmero
awk -F\" 'NR==FNR{a[$0];next}$2 in...
awk -F\" 'NR==FNR{a[$0];next}$2 in a{sub($2,"un_"$2)}1' input.txt file.txt
1,401
Posted By danmero
Is not safe to edit-in-place, use a temporary...
Is not safe to edit-in-place, use a temporary file for output and move the temporary file over old file.
2,807
Posted By rdcwayx
by awk awk ' /^START/ {s=""} /NO 0003\/02/...
by awk
awk ' /^START/ {s=""} /NO 0003\/02/ {p=1} /^END/&&p {print s RS $0;p=0} {s=s RS $0}' infile
Showing results 1 to 11 of 11

 
All times are GMT -4. The time now is 10:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy