Search Results

Search: Posts Made By: saeed.soltani
1,550
Posted By RudiC
Theres no reason your awk script awk '{print $0,"...
Theres no reason your awk script awk '{print $0," "}' in > out should not work. I see that your lines are 80 char long. Is it possible there's line wrapping occurring in your terminal/editor?
1,550
Posted By disedorgue
Hi, you can try as here: $ cat -A inp.file ...
Hi,
you can try as here:
$ cat -A inp.file
$
2012 0811 1223 15.2 L 38.393 46.806 9.0 Teh 78 0.5 6.5LTeh 1 $
GAP=74 ...
1,550
Posted By Akshay Hegde
use tr and then try awk something like this ...
use tr and then try awk something like this

$ tr -s '\n' <file | awk '$0=$0" "'
3,504
Posted By Jotne
With awk awk '/^?\?\?/ {$0="#"} 1'
With awk
awk '/^?\?\?/ {$0="#"} 1'
3,504
Posted By Don Cragun
Hi Jotne, I don't see the need for the...
Hi Jotne,
I don't see the need for the backslashes? Why not just:
awk '$1=="???"{$0="#"}1' in-file > out-file
or
awk '/^???/{$0="#"}1' in-file > out-file

Hi saeed.soltani,
This can also...
3,504
Posted By Don Cragun
Yes, obviously. I obviously didn't get enough...
Yes, obviously. I obviously didn't get enough sleep before sending that message.

For anyone who hasn't followed this discussion, the awk command:
/^???/{$0="#"}
matches any line with zero or...
3,504
Posted By Scrutinizer
@don: Since awk uses ERE when using matching, ?...
@don: Since awk uses ERE when using matching, ? has a special meaning and needs to be escaped, except for the first ? since it follows a leading caret sign and is therefore not special..
3,504
Posted By hanson44
$ sed "s/^???.*/#/" input TAB 20120201 21:02:02...
$ sed "s/^???.*/#/" input
TAB 20120201 21:02:02
MRD 20121301 22:21:01
#
SAS 20123010 12:25:41
MMT 20120102 11:01:12
POP 20120306 02:01:01
#
1,224
Posted By DGPickett
Is a 3d ellipse a 2d ellipse on a plane in 3D? ...
Is a 3d ellipse a 2d ellipse on a plane in 3D? Standard rotation, translation and scaling would return you to a unit ellipse in the xy z=0 plane. And vice-versa, in reverse order.
1,609
Posted By Yoda
awk '/^#/{print;c=0}c<2&&!/^#/{print;++c;}'...
awk '/^#/{print;c=0}c<2&&!/^#/{print;++c;}' filename
1,964
Posted By rdrtx1
roughly: awk ' # c print line counter # d...
roughly:
awk '
# c print line counter
# d skip line flag
# e skipped line counter
{if (++c % 6 && !d) { # mod test for c line count (not 0) and skip line flag set to 0
e=d=0; print ...
1,964
Posted By Don Cragun
Unless I'm missing something, the above scripts...
Unless I'm missing something, the above scripts seem overly complex. Try:
awk 'NR % 8 == 1 && NR > 1 {
# Print an empty line separator between sets of 8 input lines.
printf("\n")...
1,964
Posted By rdrtx1
try: awk '{if (++c % 6 && !d) {e=d=0; print }...
try:
awk '{if (++c % 6 && !d) {e=d=0; print } else {if (++e % 4) {d=1; c=0} else {print "\n"$0; d=e=0}}}' input
1,964
Posted By Yoda
awk 'BEGIN{L=1}{if(!(L>5&&L<9)) print; L++;...
awk 'BEGIN{L=1}{if(!(L>5&&L<9)) print; L++; if(L==9) {print " "; L=1;} } ' filename
1,042
Posted By pamu
awk '{if(NR>1){if(sqrt(($6-s)*($6-s)) > 1 &&...
awk '{if(NR>1){if(sqrt(($6-s)*($6-s)) > 1 && sqrt(($7-p)*($7-p)) > 1 && sqrt(($9-q)*($9-q)) > 5){print "###"}}}{
s=$6;p=$7;q=$9}1' file
4,482
Posted By bakunin
You could use "cut" to extract a certain range of...
You could use "cut" to extract a certain range of characters from each line:

cut -cnn-mm /path/to/infile

will extract columns nn to mm as string and display this at <stdout>. You can even...
4,482
Posted By Don Cragun
Or, since you know the field widths and want to...
Or, since you know the field widths and want to print the entire lines:
awk 'substr($0,119,4)=="ISC "' input >output
4,482
Posted By Corona688
FIELDWIDTHS is a GNU extension. What's your...
FIELDWIDTHS is a GNU extension.

What's your system?
848
Posted By pamu
awk...
awk 'FNR==NR{a[$1]=$0;next}{split(a[$1],M,FS);FV=((M[6]-$6) >=0) ? (M[6]-$6) : ($6-M[6]);
SV=((M[3]-$3) >=0) ? (M[3]-$3) : ($3-M[3]); TV=((M[4]-$4) >=0) ? (M[4]-$4) : ($4-M[4]);
if(FV < 5 && SV < 1...
848
Posted By bartus11
Try: join -j1 file1 file2 | awk...
Try: join -j1 file1 file2 | awk 'sqrt(($6-$11)^2)<5&&sqrt(($3-$8)^2)<1&&sqrt(($4-$9)^2)<1'Note that it will not print column 1 from file 2...
2,482
Posted By mirni
This will print 3rd record, not 2nd, you realize...
This will print 3rd record, not 2nd, you realize that, right?

You can make it simpler:
awk 'NR==2' RS=### infile
2,482
Posted By CarloM
{if(NR==3) print}
{if(NR==3) print}
1,440
Posted By Don Cragun
agama said he found a # by itself on a line as...
agama said he found a # by itself on a line as the section separator. When I copied the sample input and fed it through od -cb, I found that the separator line contained the octal byte values 343,...
1,440
Posted By pravin27
How abut this ? #!/usr/bin/perl $/="\n\n";...
How abut this ?
#!/usr/bin/perl

$/="\n\n";

while (<DATA>) {
chomp;
if ( ((split))[11] > 3 ) {
print ;
}
}



__DATA__
2011 0701 2015 21.2 L 37.692 46.202 18.0 Teh 4 0.3 2.1 LTeh 1...
1,440
Posted By agama
I think this does what you might be looking for: ...
I think this does what you might be looking for:


awk '
$1 == "#" { if( snarf ) print " "; snarf = 0; next; } # turn off section capture, write a trailing blank line
snarf ||...
Showing results 1 to 25 of 32

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