Search Results

Search: Posts Made By: wincrazy
2,187
Posted By vgersh99
awk '{if (out) close(out); out=$2 "-" ++f[$2]...
awk '{if (out) close(out); out=$2 "-" ++f[$2] ".txt"; sub("^[^"FS"]*"FS,""); gsub(ORS,"");print $0 >out}' RS= myFile
2,187
Posted By vgersh99
The HDR value is the second field - $2
The HDR value is the second field - $2
2,187
Posted By vgersh99
I've generalized it a bit - where the counting...
I've generalized it a bit - where the counting starts with -1 ;)

awk '{if (out) close(out); out=$2 "-" ++f[$2] ".txt"; print $0 >out}' RS= myFile
2,187
Posted By Corona688
awk -v RS="" '{ if(F) close(F); ...
awk -v RS="" '{
if(F) close(F);

N[$2]++

if(N[$2] > 1) F=sprintf("%s-%d.txt",$2,N[$2]-1);
else F=$2 ".txt";

print > F;
}' data
923
Posted By Corona688
$ echo a b c a b c a b c | awk ' { L=$0 ;...
$ echo a b c a b c a b c | awk ' { L=$0 ; while(sub("(^| )"MATCH"( |$)", "", L)) N++; print N }' MATCH="a"

3

$
1,337
Posted By vgersh99
something along these lines: awk -F, -v c=9...
something along these lines:

awk -F, -v c=9 'NF && $1!~":" && NF!=c {for(i=NF+1;i<=c;i++) $i="0.0"}1' OFS=, myFile
2,430
Posted By Chubler_XL
It's probably related to daylight savings...
It's probably related to daylight savings adjustments.

Try specifying Timezone to UTC for each data command:

$ TZ=UTC date -d 20140310 +%s
1394409600
$ expr 1394409600 - 86400
1394323200
$...
2,430
Posted By Corona688
I suspect time zones are involved. TZ="GMT" date...
I suspect time zones are involved. TZ="GMT" date ...
1,372
Posted By Don Cragun
It looks like Yoda already provided an awk script...
It looks like Yoda already provided an awk script that comes close to your requirements but adds some additional spaces in the output at the end of some of the input fields, puts the lines of hyphens...
1,372
Posted By Yoda
awk -F"--- " ' NR == FNR { ...
awk -F"--- " '
NR == FNR {
A[$1] = $(NF-1) FS $NF
next
}
$1 in A {
split ( A[$1], T )
print "CID:", $1
...
Showing results 1 to 10 of 10

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