Search Results

Search: Posts Made By: cwzkevin
1,863
Posted By Jotne
And here you see the beauty of awk :) awk...
And here you see the beauty of awk :)
awk '$1=$1' RS= infile
Note the space after RS= (same as RS="")
1,863
Posted By pamu
Or awk 'NR>1{gsub("\n"," ",$0);print "Median...
Or

awk 'NR>1{gsub("\n"," ",$0);print "Median "$0}' RS="Median" file
1,863
Posted By rdrtx1
more for the smorgasbord: awk '{printf ($0 ~ /^...
more for the smorgasbord:
awk '{printf ($0 ~ /^ *$/) ? "\n" : $0 " " } END {print ""}' input
or, look Ma! no awk!
while read line
do
printf "$line "
[ -z "$line" ] && echo ""
done < input...
1,863
Posted By in2nix4life
It's an awk buffet: awk...
It's an awk buffet:


awk '/Median/{if(NR!=1)print " ";}{printf("%s ", $0)}END{print " ";}' file
1,863
Posted By jim mcnamara
awk '/^$/ {print } /^[M0-9]/ {printf...
awk '/^$/ {print }
/^[M0-9]/ {printf ("%s ", $0) }
END {print ""} ' inputfile > newfile
1,863
Posted By rdrtx1
try: awk ' /^ *$/ {print} !/^ *$/ {printf $0 "...
try:
awk ' /^ *$/ {print} !/^ *$/ {printf $0 " "} END {print ""}' input
2,152
Posted By RudiC
This works (on linux with bash and GNU tools!)...
This works (on linux with bash and GNU tools!) for your four line 24 char example from post #1:$ cat sedfile
1 {s/\(.\)/\1\n/g;w1.tmp
}
2 {s/\(.\)/\1\n/g;w2.tmp
}
3 {s/\(.\)/\1\n/g;w3.tmp
...
2,152
Posted By RudiC
22 lines of 3,278,824 chars to be compared char...
22 lines of 3,278,824 chars to be compared char by char!? Wouldn't it be much easier if we could transpose that matrix (yet I don't know how, right now, from the top of my head) ?
2,152
Posted By pamu
For your second requirement.. assuming you...
For your second requirement..

assuming you have same number of characters per line..

try this..

sed -e 's/.\{1\}/& /g' file | awk '{ for(i=1;i<=NF;i++){a[NR,i]=$i;max=NF}maN=NR;}END{
for...
2,152
Posted By delugeag
I think you can do it with awk ? the 1) ...
I think you can do it with awk ?
the 1)

awk '
/^.........patern/ {n+=1}
/^.....patern/ {m+=1}
end {print n ; print m}
' file 6 "." is for the patern in the 7th column.
2,159
Posted By jim mcnamara
You need to use an array. The following is a...
You need to use an array. The following is a bash array example.
Arrays start counting at 0 (zero), so an array of three words has 3 elements: word1 word2 word3

word1 is 0, word2 is 1, word3 is...
2,159
Posted By msabhi
awk -F"\t "...
awk -F"\t " '{printf("ID=%s,START=%s,END=%s\n",$11,$5,$6);}' input_file
71,333
Posted By Ygor
Avoid the UUOC by using...cut -f1-6,8- filename
Avoid the UUOC by using...cut -f1-6,8- filename
Showing results 1 to 13 of 13

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