Search Results

Search: Posts Made By: linuxkid
2,223
Posted By methyl
One way (at the top of the script). if [ $#...
One way (at the top of the script).

if [ $# -eq 0 ]
then
echo "please enter an option; -a for today, and -b for yesterday"
exit
fi
2,893
Posted By zaxxon
If I understood it right (I added 3 exclamation...
If I understood it right (I added 3 exclamation marks to represent 2 fields for easier spotting):

$> cat infile
one two three
one
two
three
four five six
four
five
six !!!
seven eight...
2,111
Posted By karthigayan
use '\b' to match the end of the number , ...
use '\b' to match the end of the number ,


[0-9]+0\b
6,044
Posted By dennis.jacob
If I got you correctly,Try: awk 'NF>2 {...
If I got you correctly,Try:

awk 'NF>2 { print $1" "$2; $1=$2=""; print; }' file
6,044
Posted By radoulov
awk 'NF > 2 { for (i = 0; ++i <= NF;) ...
awk 'NF > 2 {
for (i = 0; ++i <= NF;)
printf "%s", ($i (i == 2 ? RS : FS))
print x
}' infile
6,044
Posted By Scott
Hi. You could use a for-loop: for( i...
Hi.

You could use a for-loop:


for( i = 3; i <= NF; i++ ) ...
Or, perhaps:

$ echo 1 2 3 4 5 6 | awk '{if( NF > 2) { $3 = RS $3}}1'
1 2
3 4 5 6
6,456
Posted By rdcwayx
or: awk 'NR==FNR {for (i=2;i<=NF;i+=2) a[$1...
or:

awk 'NR==FNR {for (i=2;i<=NF;i+=2) a[$1 FS $i]=$(i+1) ;next}
{printf $1 FS} {for (i=($3*10);i>=($2*10);i--) printf i/10 FS a[$1 FS i/10] FS}{printf "\n"}' File2 File1
5,263
Posted By radoulov
Usually you use shell scripting to invoke...
Usually you use shell scripting to invoke external commands. awk is such an external command. It's quite powerful tool for text processing. When I tell you to use gawk, nawk etc, I'm just saying not...
4,714
Posted By radoulov
perl -nle' /(?:abc|def)/ and print join " ",...
perl -nle'
/(?:abc|def)/ and print join " ", /(?:abc|def)[\w-]+/g
or print
' infile
Showing results 1 to 9 of 9

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