Search Results

Search: Posts Made By: buncit8
1,372
Posted By rdrtx1
awk ' NR > 1 {printf ($0 ~ /^Source/) ? " " :...
awk '
NR > 1 {printf ($0 ~ /^Source/) ? " " : "\n"; }
{printf $0}
END { if ($0 ~ /^Source/) print ""}
' data
1,372
Posted By RudiC
WHAT don't you get? Please be way more eloquent,...
WHAT don't you get? Please be way more eloquent, showing non-satisfying output and error messages. rdrtx1's proposal works for me.
1,022
Posted By rdrtx1
awk -F";" 'NF==1 {name=$0; next} {print $0,...
awk -F";" 'NF==1 {name=$0; next} {print $0, name}' OFS=";" data
3,102
Posted By Chubler_XL
OK, spaces on end of lines were causing issues,...
OK, spaces on end of lines were causing issues, try this:

awk '
{gsub(/ +$/,"") }
/^ {11}[^ ].*:[0-9.]{5}$/ {
if(p) print p;
if(NF==6) p=$1";"$2";"$3";"$4";"$5" "$6
else...
3,102
Posted By Chubler_XL
The supplied solution is very dependent on the...
The supplied solution is very dependent on the format of you input file.

In particular the number of spaces at the front of each line and the number of fields on each line.

Also ensure file...
3,102
Posted By Chubler_XL
Matching using combination of number of leading...
Matching using combination of number of leading spaces and field counts may work for you:

awk '
/^ {11}[^ ].*:[0-9.]{5}$/ {
if(p) print p;
if(NF==6) p=$1";"$2";"$3";"$4";"$5" "$6
...
1,390
Posted By bartus11
Does it have to be AWK?perl -aF";" -ple '$_=join...
Does it have to be AWK?perl -aF";" -ple '$_=join ";", (@F[0..4],sort {$b <=> $a} @F[5..$#F])' file
1,390
Posted By shamrock
Here's an awk script you can try... awk '{ ...
Here's an awk script you can try...

awk '{
n = split($0, a, ";")
for (i = 1; i < (n + 1) - 6 ; i++)
for (j = 6; j < (n + 1) - i; j++)
if (a[j] < a[j+1]) {
...
1,449
Posted By elixir_sinari
Seems like you didn't search well....:) ...
Seems like you didn't search well....:)


awk 'NR==FNR{a[$1]=$2;next} {print $1,a[$1],$2}' main.txt code.txt
1,035
Posted By itkamaraj
$ while read char; do nawk -v ch=$char...
$ while read char; do nawk -v ch=$char '{printf("%s%s\n",ch,$1)}' file2; done < file1
A1
A2
A3
A4
B1
B2
B3
B4
C1
C2
C3
C4
D1
D2
D3
D4
1,529
Posted By sk1418
straightforward way: awk -F"," 'BEGIN{print...
straightforward way:

awk -F"," 'BEGIN{print "ID,OUT1,OUT2,OUT3"}
NR>1{o1=0;o2=0;o3=0;
for(i=2;i<=NF;i++){
o1+=($i<=2)?1:0;
o2+=($i==3||$i==4)?1:0;
...
1,529
Posted By kato
A bit messy, but: awk -F, 'NR==1{print...
A bit messy, but:

awk -F, 'NR==1{print $1",OUT1,OUT2,OUT3";next}{b=substr($0,length($1)); print $1","gsub(/[12]/,"",b)","gsub(/[34]/,"",b)","gsub(/[56]/,"",b)}' file
Showing results 1 to 12 of 12

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