Search Results

Search: Posts Made By: phaethon
7,717
Posted By Chubler_XL
Try this: awk '{print "date -d \x27" $3, $4...
Try this:

awk '{print "date -d \x27" $3, $4 "\x27 +\x22%s" OFS $9 "\x22"}' file.txt | sh

or this

awk '{system("date -d \x27" $3 " " $4 "\x27 +\x22%s " $9 "\x22")}' file.txt

Or if you...
2,742
Posted By RudiC
Try awk '{print "wget http://example/data/$(...
Try
awk '{print "wget http://example/data/$( date -d \42 " $1 " \42 +\42%Y.%j\42." $2 ")"}' file.txt | sh
2,742
Posted By RudiC
Did you try to separate the two command by a...
Did you try to separate the two command by a semicolon?
1,808
Posted By Don Cragun
The following seems to do what you want, but...
The following seems to do what you want, but since your output format is not consistent (no date before first output group, inconsistent spacing), I'm not sure if this is what you want:
awk '
!head...
4,536
Posted By RudiC
With a recent shell, this might work:while { read...
With a recent shell, this might work:while { read -n4 A; read -n2 B; read -n2 C; read -n2 D; read -n2 E; read REST; }; do echo $A $B $C $D $E; done < file
2012 01 13 24 35
2012 02 14 12 10
2013 04...
4,536
Posted By Don Cragun
It looks like Aia guessed correctly by ignoring...
It looks like Aia guessed correctly by ignoring the last dollar-sign in your original post:
curl -L http://webpage/${yr}/${mo}/track${yr}${mo}${da}${ho}${mi}$_infos.html
When the shell processes...
4,536
Posted By Don Cragun
What Aia suggested is fine if you're using a...
What Aia suggested is fine if you're using a system where /bin/sh is not a pure Bourne shell (as it is on Solaris systems) or a 1988 Korn shell (as it is on many AIX systems). But, in addition to...
4,536
Posted By Aia
yr=`awk '{$1=substr($1, 6, 2)}1' file1` yr...
yr=`awk '{$1=substr($1, 6, 2)}1' file1`

yr will not hold just one year, but every year for each line in file1. The same for each of your variables mo, da, ho and mi. Nonetheless, the characters...
3,429
Posted By RavinderSingh13
Hello phaethon, Following may help you in...
Hello phaethon,

Following may help you in same, considering that 1st field will always have string name in it. Please do let us know if you have more conditions too to get your output.

awk...
3,429
Posted By Yoda
awk 'NR==FNR{A[$1];next}!($1 in...
awk 'NR==FNR{A[$1];next}!($1 in A)&&$1!=10{M[$1]}END{for(k in M) print k}' file1 file2
1,227
Posted By Yoda
Another awk approach:- awk...
Another awk approach:-
awk '$1==10{split("",A);next}++A[$1]>1' file
1,227
Posted By SriniShoo
slight modification to Yoda's approach to not...
slight modification to Yoda's approach to not print duplicates for each set in the output
awk '$1==10{split("",A);next}++A[$1]==2' file
2,166
Posted By RavinderSingh13
Hello phaethon, Following may also help you...
Hello phaethon,

Following may also help you in same.

awk 'FNR==NR{A[$1 OFS $2]=$3;next} ($1 OFS $2 in A){$9=A[$1 OFS $2];print} !($1 OFS $2 in A){$9="NA";print}' file2 file1


Output will...
2,166
Posted By Don Cragun
What have you tried? There are lots of...
What have you tried?

There are lots of threads with similar problem statements listed at the bottom of the page for this discussion. Did you look at any of them? Can't you adapt the suggestions...
2,166
Posted By Don Cragun
Try this instead: awk ' FNR == NR { k[$1,...
Try this instead:
awk '
FNR == NR {
k[$1, $2] = $3
next
}
{ $9 = (($1, $2) in k) ? k[$1, $2] : "NA"
}
1' file2 file1
With your sample input, this produces the output:
110103 0802 1.16 38...
1,256
Posted By RavinderSingh13
Hello Senhia83/Phaethon, Yes script looks...
Hello Senhia83/Phaethon,

Yes script looks to work same as requested, but it is always good practice to mention the complete path in spite of relative path. Otherwise we need to put the script a...
1,256
Posted By senhia83
In your old directory (dir1) mkdir ../newdir...
In your old directory (dir1)

mkdir ../newdir

for file in *
do
awk '$20<40' $file > ../newdir/$file
done


Note that newdir will be same level as your olddir
3,121
Posted By ongoto
Will GAP number and RMS num ever be in the same...
Will GAP number and RMS num ever be in the same line?
or is the test to be for their one time occurance in the whole file?
3,121
Posted By senhia83
Maybe this will help, could be done more...
Maybe this will help, could be done more elegantly of course..


for file in *
do
gap=$( awk '/Gap/' "$file" | sed -e 's/.*Gap//;' | awk '{print $1}' );
rms=$( awk '/RMS/' "$file" | sed...
3,121
Posted By Don Cragun
In addition to what ongoto and RavinderSingh13...
In addition to what ongoto and RavinderSingh13 asked, Is RMS also always in a fixed column?
3,121
Posted By RavinderSingh13
Hello phaethon, You should us some input and...
Hello phaethon,

You should us some input and more details like is RMS and GAP will be on same line. After making an assumption like you have
RMS as 12th field only and is on a different line...
3,030
Posted By MadeInGermany
Use printf "%s",string instead of print...
Use printf "%s",string instead of print string!
3,030
Posted By RudiC
With all the irregularities of spaces and commas...
With all the irregularities of spaces and commas between your meaningful fields, it might be best to use awk versatile field separator definition. Try:awk '$1=="nmm" {gsub...
3,030
Posted By Aia
Got Perl? perl -00 -wne '@values = $_ =~...
Got Perl?

perl -00 -wne '@values = $_ =~ /(\d+\.?\d+)/g and print "@values\n"' file.txt
3,030
Posted By Scrutinizer
A quick alternative is to run your script...
A quick alternative is to run your script through:
| paste -d " " - - -
Showing results 1 to 25 of 45

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