Search Results

Search: Posts Made By: jpkumar10
1,392
Posted By summer_cherry
awk + python
awk:
gawk '{
if(NR==FNR){
_[$1]=$2
}
else{
if(/Storage/){
name=$NF
}
else{
if(NF==2){
l[name]+=_[$2]...
1,945
Posted By Scrutinizer
A simpler version without adaptive column widths:...
A simpler version without adaptive column widths:
awk '
$1=="for"{
A[I=$2]
next
}
NF{
if($1 in A){
sub(ORS, T[$1]+$2 ORS, A[$1])
printf "%s",$1 A[$1]
}
...
1,945
Posted By Don Cragun
Hi jpkumar10, I think I have something that...
Hi jpkumar10,
I think I have something that works, but the spacing is different (making the computed 4th column values line up with the end of the heading for that column) and I disagree with the...
992
Posted By complex.invoke
awk '$1{gsub(/\n/," ");print RS$0}' RS="name"...
awk '$1{gsub(/\n/," ");print RS$0}' RS="name" infile
992
Posted By pravin27
awk '{if(/name/){printf "\n%s ",$0;} else{ printf...
awk '{if(/name/){printf "\n%s ",$0;} else{ printf "%s ",$0;}} END {printf "\n";}' filename
1,760
Posted By Scrutinizer
NOTE: these solutions are GNU only, nothing wrong...
NOTE: these solutions are GNU only, nothing wrong with that, but this will not work on every platform...
1,760
Posted By Peasant
See if this helps : awk...
See if this helps :


awk '{gsub("[0-9][0-9]","&:",$1);sub(":$","",$1) }1 ' input


Regards
Peasant
1,760
Posted By complex.invoke
awk 'BEGIN{FIELDWIDTHS="2 2 2 2 2 2 2...
awk 'BEGIN{FIELDWIDTHS="2 2 2 2 2 2 2 7"}{OFS=":"; print $1,$2,$3,$4,$5,$6,$7 $8}' infile
1,760
Posted By SaCai
[root@dist unix]# sed 's/../&:/g;s/://7g' file ...
[root@dist unix]# sed 's/../&:/g;s/://7g' file
21:00:00:12:34:34:56 asdf
21:00:00:12:34:34:78 asd3
21:00:00:12:34:34:23 asdf
21:00:00:12:34:34:45 asdf
21:00:00:12:34:34:89 asdf
1,001
Posted By Franklin52
Try this: awk -F":" '/name/{s=$2;next} /id/{s=s...
Try this:
awk -F":" '/name/{s=$2;next} /id/{s=s "/" $2;next} {print $1 OFS s}' file
1,126
Posted By ahamed101
awk...
awk 'NR==FNR{a[$1]=substr($0,length($1)+2);next}{if(a[$3]){print $0,a[$3]}}' file2 file1
--ahamed
1,126
Posted By rdcwayx
awk 'NR==FNR{a[$1]=$0;next} {print $0, $3 in...
awk 'NR==FNR{a[$1]=$0;next} {print $0, $3 in a?a[$3]:"some crap"}' file_2 file_1
1,890
Posted By Franklin52
Something like this? awk 'NF==2{h=$1;...
Something like this?
awk 'NF==2{h=$1; array[h]=$2; next}{array[h]=array[h] "," $1} END{for(i in array)print i "=" array[i]}' file
Showing results 1 to 13 of 13

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