Search Results

Search: Posts Made By: abercrom
2,607
Posted By shamrock
No need for the while loop...first remove...
No need for the while loop...first remove everything that follows the comma on each line of the pattern file with awk and pipe its output to grep...
awk -F, '{print $1}' pattern_file | xargs grep {}...
2,607
Posted By Juha Nurmela
The script snippet looks garbled. It sounds like...
The script snippet looks garbled. It sounds like the wildcard in the pattern got expanded by the shell at some point. You need more double quotes where it happens :)

But aren't you making it too...
837
Posted By Akshay Hegde
Try $ cat file aaad_1577 64000 ...
Try

$ cat file
aaad_1577 64000
aaad_1577 72000
aaad_1577 72000
aaad_1577 65000
aaad_1577 65000
bbbd_2002 56000
bbbd_2002 57000
bbbd_3045 57000
cccd_3452 150000
dddd_6014 150000...
1,326
Posted By Yoda
An awk approach that might work: awk ' ...
An awk approach that might work:
awk '
{
if ( R[$1] )
{
c = R[$1]
c = c + 1
...
1,326
Posted By Chubler_XL
Another smaller awk solution: awk ' { ...
Another smaller awk solution:

awk '
{
if ($1!=P) {
v[++C,0]=P=$1;
F=1;
}
v[C, F++]=$2
M=(F>M)?F:M
}
END {
for(j=0;j<M;j++) {
for(i=0;i<=C;i++)
...
1,523
Posted By Scrutinizer
Try: awk '{gsub(/,/,"_",$1)}1' FS=XX OFS=XX...
Try:
awk '{gsub(/,/,"_",$1)}1' FS=XX OFS=XX file
Showing results 1 to 6 of 6

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