Search Results

Search: Posts Made By: Scottie1954
2,402
Posted By Yoda
awk -F, '{sub(/ .*/,x,$3)}1' OFS=, file
awk -F, '{sub(/ .*/,x,$3)}1' OFS=, file
1,284
Posted By Don Cragun
Do you mean something like: awk ' /TOTAL...
Do you mean something like:
awk '
/TOTAL TYPE:/ {
printf("%s %s %s %s\n", $1, $2, $3, s)
next
}
{ s = substr($0, 50, 2)
}' file1 > file2which produces:
TOTAL...
2,936
Posted By MadeInGermany
awk ' NR==FNR {a[$1]=1; next} ($1 in a) '...
awk '
NR==FNR {a[$1]=1; next}
($1 in a)
' shortfile longfile

A $1+0 cast is not needed because all numbers have equal length.
HP-UX awk is very similar to nawk.
2,073
Posted By Yoda
awk ' { if(($0 ~ /^700/)&&(substr($0,11,2)==79))...
awk ' { if(($0 ~ /^700/)&&(substr($0,11,2)==79)) print; } ' filename
1,036
Posted By vgersh99
what shell are you using? works fine on bash on...
what shell are you using?
works fine on bash on Linux.

Try using '\\n' instead of '\n'
4,525
Posted By elixir_sinari
awk '/132\.101-/{print;getline;print}' INFILE1 >...
awk '/132\.101-/{print;getline;print}' INFILE1 > outfile1

Following are the issues with your awk:

awk '/132.101-/{f=2;print;next}f{print;exit}' INFILE1 >outfile1

1) The regex is not correct...
5,108
Posted By gull04
Hi Scottie1954, Try the following, there are...
Hi Scottie1954,

Try the following, there are two spaces before the star;

cat "filename" | sed 's/, */,/g' > "newfilename"

Regards

Dave
1,538
Posted By Scrutinizer
Try sed "1,${LINE}d". Alternatively, try: sed...
Try sed "1,${LINE}d". Alternatively, try:
sed -n '/PLASTICS THAT EXPIRE/,$p' infile
5,332
Posted By alister
Chubler_XL's suggestion is missing a semicolon. ...
Chubler_XL's suggestion is missing a semicolon. To be posix-compliant, there should be a semi-colon after the d command:
sed '/[0-9]-[0-9][0-9]/{N;/\n$/d;}' infile > outfile

With regard to my...
5,332
Posted By Chubler_XL
@Alister - Nice explination and good pickup on...
@Alister - Nice explination and good pickup on pattern on last line of file

Scottie1955 - You could try using awk:

awk '/[0-9]-[0-9][0-9]/ { K=$0; next }
K { if(length) print K "\n" $0;...
Showing results 1 to 10 of 10

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