Search Results

Search: Posts Made By: kykyboss023
8,889
Posted By Scrutinizer
Try: awk -F, '{for(i=1;i<=NF;i++)A[$i]=i;print...
Try:
awk -F, '{for(i=1;i<=NF;i++)A[$i]=i;print "The field "v" is on position "A[v];delete A}' v=IDENTIFIER infile
or without arrays:
awk -F, '{for(i=1;i<=NF;i++)if($i==v)print "The field "v" is on...
8,889
Posted By radoulov
perl -F, -lane'BEGIN { $f = shift } ...
perl -F, -lane'BEGIN {
$f = shift
}
$F[$_] eq $f
and print "The field $f is on position ", ++ $_
for 0 .. @F
' IDENTIFIER infile


---------- Post updated at 04:02 PM...
28,274
Posted By vgersh99
sed 's/.*,//;G;s/\n/&yes/' $FILE
sed 's/.*,//;G;s/\n/&yes/' $FILE
28,274
Posted By ctsgnb
awk -F"," '{print$5"\nyes"}'...
awk -F"," '{print$5"\nyes"}' $FILE
28,274
Posted By Chubler_XL
If you really want to populate a shell array this...
If you really want to populate a shell array this should do it: I used awk to fetch field 5 and put quotes around it and then eval to assign array.

eval array=( $(awk -F, '{print "\""$5"\"";}'...
28,274
Posted By rdcwayx
cut -f5 -d"," $FILE |while read line do...
cut -f5 -d"," $FILE |while read line
do
echo $line
echo yes
done
Showing results 1 to 6 of 6

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