Search Results

Search: Posts Made By: sol_nov
4,621
Posted By bartus11
Few corrections:perl -i -0pe...
Few corrections:perl -i -0pe 's/^Time=(.*)\nVersion=(.*)/EndTime=$1\nVersion=$2/mg' a.txtPerl is not sed. You don't need to escape everything... ;)
2,433
Posted By linuxpenguin
ok, I get it Here you go sort a.txt |...
ok, I get it
Here you go


sort a.txt | awk -F'=' 'BEGIN {l=null} $1 ~ /Time|Server|Run|Tables/ {if($1 != l ) {l=$1; printf("\n%s ",$1)} else { printf("%s ",$2)}}'
2,233
Posted By Chubler_XL
How about using sed: sed...
How about using sed:

sed 's:|[^|]*pi=\[\([^]]*\)],uid=\[\([^]]*\)].*:|\1|\2:' scenario_1.txt > scenario_1_n.txt
sed 's:|[^|]*390=\([^,]*\),391=\([^,]*\),.*:|\1|\2:' scenario_2.txt >...
4,452
Posted By Yoda
How about a KSH script? #!/bin/ksh while...
How about a KSH script?
#!/bin/ksh

while IFS="|" read f1 f2 f3
do
echo "$f1|$f2|$f3" >> sample_1_$f2.txt
done < sample_1.txt
4,452
Posted By Yoda
awk -F\| '{ filename="sample_1_"$2".txt"; print...
awk -F\| '{ filename="sample_1_"$2".txt"; print $0 > filename } ' sample_1.txt
2,106
Posted By balajesuri
Or: | xargs perl -i -pe 'if(eof){s/...........'...
Or:
| xargs perl -i -pe 'if(eof){s/...........'

Or you may use sed too:
For substituting in first line: sed -i '1s///g'

For substituting in last line: sed -i '$s///g'
2,148
Posted By Corona688
That final EOF needs to be at the beginning of...
That final EOF needs to be at the beginning of the line, you can't indent it.

If that doesn't help, show your code please.
2,106
Posted By bartus11
It requires some changes to the way you edit the...
It requires some changes to the way you edit the file (you have to load whole file as one line):find file_1.out -type f | xargs perl -i -p0e 's/<tr> MAIL #(.*)$/<tr><td colspan="4" class="hcol"> MAIL...
2,106
Posted By bartus11
This should replace only on first line in each...
This should replace only on first line in each file:find file_1.out -type f | xargs perl -pi -e '$.==1&&s/<tr> MAIL #/<tr><td colspan="4" class="hcol"> MAIL #/gi; s/ <\/tr>/<\/td><\/tr>/gi'
1,553
Posted By RudiC
Tryawk 'NR==1{getline L2; $1=$1"<td colspan =...
Tryawk 'NR==1{getline L2; $1=$1"<td colspan = "gsub(/\/td/,"&",L2)" >";$8="</td>"$8;print; print L2} NR>2' file
1,553
Posted By Don Cragun
Try: #!/bin/ksh awk '/MAIL #/ {save=$0;next} ...
Try:
#!/bin/ksh
awk '/MAIL #/ {save=$0;next}
save!="" {
x=gsub("</td>","&")
sub(" .* <","<td colspan=" x ">&/td><", save)
print save
save=""
}
{print}...
1,712
Posted By RudiC
Well, your request could have been a bit clearer,...
Well, your request could have been a bit clearer, e.g. where to get the "From:sol@yahoo.com" from, but based on some assumptions, try this:awk 'function prhd () {print "From:sol@yahoo.com\nTo:...
2,477
Posted By bartus11
Did you try code I posted earlier?perl -ple 's/[^...
Did you try code I posted earlier?perl -ple 's/[^ ]+/<td class="cB">$&<\/td>/g;s/> </></g;s/.*/<tr>$&<\/tr>/' file
2,477
Posted By Corona688
awk -v OFS="</td><td class="cB">" '{ $1=$1; print...
awk -v OFS="</td><td class="cB">" '{ $1=$1; print "<tr><td class="cB">", $0, "</td></tr>" }' input > output
2,477
Posted By bartus11
This should work:find file.out -type f | xargs...
This should work:find file.out -type f | xargs perl -pi -e '/cRB/&&s/cB/cRB/gi'
11,589
Posted By durden_tyler
What did you try ? tyler_durden
What did you try ?

tyler_durden
Showing results 1 to 16 of 16

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