Visit Our UNIX and Linux User Community

Search Results

Search: Posts Made By: sdf
780
Posted By RudiC
Show us your attempts! ---------- Post...
Show us your attempts!

---------- Post updated at 15:41 ---------- Previous update was at 15:36 ----------

Howsoever, tryawk '/Estimate|realized/ {printf "%s%s ", $1, FS} /USD|Date:/' FS=":"...
3,083
Posted By RudiC
Try awk ' NR==FNR {a[$0] ...
Try awk '
NR==FNR {a[$0]
next
}
{for (i in a) {m=split (i, b, " ")
for (j=1; ($0 ~ b[j]) && j<=m;...
15,115
Posted By Jotne
awk -F"[a-z=&\"]*" '{print $2,$3,$4}' infile 70...
awk -F"[a-z=&\"]*" '{print $2,$3,$4}' infile
70 15481 6991901
7078 15482 70121
709 15484 70183944

@Yoda
I get this with your solution
70 15481 6991901
7078 15482 70121
709 15484 70183944
15,115
Posted By Yoda
Here is an awk approach: awk...
Here is an awk approach:
awk '{gsub(/[[:punct:]]+|[[:alpha:]]+/," ");sub(/^[ ]*/,x);NF-=2}1' file
1,062
Posted By guruprasadpr
Hi awk -v p="1-2,4-13,16,19-20,21-25,31-32"...
Hi

awk -v p="1-2,4-13,16,19-20,21-25,31-32" -v dn="file.pdf" 'BEGIN{ORS=" "; x=split(p,t,",");for (i=1;i<=x;i++) if(t[i] ~ /-/) {split(t[i],t1,"-"); print "-dFirstPage=" t1[1] ,"-dLastPage="...
1,062
Posted By raj_saini20
here is corrected one awk -v...
here is corrected one

awk -v p="1-2,4-13,16,19-20,21-25,31-32" -v dn="file.pdf" 'BEGIN{ORS=" ";n=split(p,t,",");for (i=1;i<=n;i++) if(t[i] ~ /-/) {split(t[i],t1,"-"); print "-dFirstPage=" t1[1]...
2,365
Posted By Corona688
$ cat fmrg.awk !F { F=FILENAME; FILENUM=1 } ...
$ cat fmrg.awk

!F { F=FILENAME; FILENUM=1 }
F != FILENAME { FILENUM++; F=FILENAME }

{
if((!MIN) ||(MIN>$1)) MIN=$1
if((!MAX) ||(MAX<$1)) MAX=$1
R[$1]++;...
2,211
Posted By jlliagre
The test is pointless, just remove it: ...
The test is pointless, just remove it:
'{nr[$1]=$2;f = $1} END{for (i=1;i<=f;i++) print i, nr[i] }'
2,572
Posted By Corona688
awk '{ for(N=1; N<=NF; N+=2) print $N, $(N+1); }'...
awk '{ for(N=1; N<=NF; N+=2) print $N, $(N+1); }' filename > outfile
5,916
Posted By Chubler_XL
Sorry, just caught me on a bad day I suppose. ...
Sorry, just caught me on a bad day I suppose.

I must admit I was very tempted to supply the following myself:
sed 's/[.,][^=.,]*$//' infile
5,916
Posted By rdcwayx
awk '{gsub(/[,.].*/, "",$2)}1' FS="=" OFS="="...
awk '{gsub(/[,.].*/, "",$2)}1' FS="=" OFS="=" infile
2,312
Posted By ahamed101
Try this... awk 'NR==FNR{a[$0]++;next}{for(i in...
Try this...
awk 'NR==FNR{a[$0]++;next}{for(i in a){gsub(i,"",$0);gsub("[,.] *$","")}}1' patternlist infile
--ahamed
21,441
Posted By Corona688
What other lines? I thought each file was one...
What other lines? I thought each file was one line...

If not, how about this?

awk -v ORS=" " 'LF != FILENAME { print FILENAME; LF=FILENAME }; {$1=$1} 1; END { printf("\n"); }' *.txt
21,441
Posted By Corona688
It would've been nice to know if those did what...
It would've been nice to know if those did what you wanted. If they don't, neither will the same thing written in awk! :wall:

ORS controls the output record separator, which is a newline by...
21,441
Posted By Corona688
You realize these are the UNIX forums, yes? ...
You realize these are the UNIX forums, yes? :wall:

Either way is a complete no-op. The only point of it is to inform awk that the data has changed, so that it should translate the newlines into...
4,742
Posted By radoulov
Try this: awk '/\xA0/ { print FILENAME, FNR...
Try this:

awk '/\xA0/ { print FILENAME, FNR }' *.txt
2,387
Posted By vgersh99
nawk '{ for(i=1;i<=NF;i++) if ($i ~...
nawk '{
for(i=1;i<=NF;i++)
if ($i ~ "^[2-3][.,][0-9][0-9]$" && $i>=2.30 && $i<=3.99)
print $i
}' myFile
4,637
Posted By bartus11
Try: awk 'NR==FNR{print;next}!/EL/' header.txt...
Try: awk 'NR==FNR{print;next}!/EL/' header.txt input.txt
2,551
Posted By ahamed101
if s is not empty then s=s FS $i if s is empty...
if s is not empty then s=s FS $i
if s is empty then s=x $i

if(s){
s=s FS $i
} else {
s=x $i
}


HTH
--ahamed
4,203
Posted By ahamed101
Try this... awk...
Try this...

awk '/^[0-9]/{match($0,"([0-9]*[; ]*[a-zA-Z].*)",a); $0=a[1]}1' input_file


--ahamed
4,203
Posted By ygemici
if you have gnu sed maybe u can try this $ sed...
if you have gnu sed maybe u can try this
$ sed '1~2s/.* \([^ ]* [^ ]* [^ ]* [^ ]*\)/\1/'
15,744
Posted By rdcwayx
awk -F, '{for (i=2;i<=NF;i++)...
awk -F, '{for (i=2;i<=NF;i++) a[$i]=a[$i]==""?$1:a[$i] FS $1}
END{for (i in a) if (i>0)print i FS a[i]|"sort -n"}' infile

1,A1,A3,A4
2,A1,A3
3,A3,A4
4 3,A1
4,A4
5,A1,A3,A4
6,A1...
15,744
Posted By rdcwayx
I guess the result need be sorted. awk -F ,...
I guess the result need be sorted.
awk -F , '{for (i=2;i<=NF;i++) if ($i>=0) print $1 FS $i|"sort -t, -k1,1 -k2,2n"}' infile

A1,1
A1,2
A1,4 3
A1,5
A1,6
A2,7
A2,8
A2,9
A2,10
A2,11
A2,12...
15,744
Posted By vgersh99
this is not really a matrix transposition - this...
this is not really a matrix transposition - this is a hybrid of some kind. And your desired output is not consistent - in particular the A3 and the A4 sequences...
A better/consistent example,...
2,926
Posted By yazu
Here is my code but it doesn't work. It's because...
Here is my code but it doesn't work. It's because of line ends. Somewhere you have dots, somewhere commas and in one line - 704/11 762,.

perl -F',\s+' -lane ' ...
Showing results 1 to 25 of 40

 

Featured Tech Videos

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