Search Results

Search: Posts Made By: manas_ranjan
2,496
Posted By nezabudka
Hi You can use the GNU extension - the 'asorti'...
Hi
You can use the GNU extension - the 'asorti' function in 'awk'
awk -F' *|-' -vm="$(LC_ALL=C locale ab_alt_mon)" '
BEGIN {for(n=split(m, M, ";"); n; n--) Mm[M[n]]=n}
{A[$7 Mm[$6] $5...
51,795
Posted By RudiC
How about grep -o...
How about
grep -o 'filename-[[:digit:].]*.tar.gz' file
filename-1.0.0.tar.gz
1,144
Posted By RudiC
It REALLY were helpful IF you could verbally,...
It REALLY were helpful IF you could verbally, carefully, detailedly describe your request and not leave it to the people in here to guess what you want from inconsistent samples! There's no position2...
1,020
Posted By rdrtx1
See update.
See update.
5,387
Posted By Scrutinizer
rdrtx1's approach is probably the way to go,...
rdrtx1's approach is probably the way to go, since it can parse the JSON syntax properly.

Here is an example what might be done with awk:awk '
/\{[ \t]*$/{
level++
}
/^[ \t]*\},?[...
5,387
Posted By rdrtx1
Since it is a JavaScript object try JavaScript...
Since it is a JavaScript object try JavaScript using your favorite browser (then save the page to create a file, or write JavaScript to save to file (if the browser supports it)):
<html>
<head>...
1,460
Posted By RudiC
Not good, either. Trysed ':L; s/,,/,0,/; tL' file
Not good, either. Trysed ':L; s/,,/,0,/; tL' file
1,677
Posted By RudiC
Well, I don't think there's a general solution...
Well, I don't think there's a general solution for all possible scenarios. In this special case, try awk 'NR==FNR {X=$0; gsub($1 FS,"",X);R[$1]=X; next} {for (r in R) gsub ("[[]"r"[]]", R[r]);...
1,677
Posted By RudiC
This is my result with above snippet and...
This is my result with above snippet and samples:iHere is my sample test file 1st_FILE.txt.
This will be replaced by 1st_FILE.txt.The problem is awk regards "[" and "]" as special chars to build a...
2,016
Posted By Don Cragun
I tried using floating point (as Jim suggested),...
I tried using floating point (as Jim suggested), but with some additional testing I found the results were occasionally off by a microsecond. The following seems to work even when time stamps roll...
5,243
Posted By pamu
awk -F, 'NR==FNR{if($2 ~...
awk -F, 'NR==FNR{if($2 ~ /VAR/){X[$1]+=$3};next}{P=1;if($2 ~ /VAR/ ){if(! arr[$1]){$2="TOTAL_VAR";$3=X[$1];P=1;arr[$1]++}else{P=0}}}P' OFS="," file file
1,796
Posted By elixir_sinari
awk '$13 < lastdur {print ++i " GC started at "...
awk '$13 < lastdur {print ++i " GC started at " start " and continued for " lastdur " mins."
start=$1
recstart=1}
NR==1{start=$1;recstart=1}
{lastdur=$13}
END{if(recstart) print ++i " GC started...
1,796
Posted By RudiC
You're right. Tryawk 'NR > 1 && $13 <...
You're right. Tryawk 'NR > 1 && $13 < LASTMIN {print ++CNT, ". GC ...", STTIME, "...",LASTMIN}
NR == 1 || $13 < LASTMIN {STTIME = $1}
{ LASTMIN = $13}
END{print...
1,796
Posted By pamu
is this what you want..? awk -v...
is this what you want..?

awk -v VM="first,second,third" -v GC="GC started at" -v CN="and continued for" -v MN="mins" '{split(VM,P,",")
if($0 ~ /running from last 3 min/) {
if(s){a++;print...
8,812
Posted By pamu
try this.. awk -F, '{if(NR!=1){for...
try this..


awk -F, '{if(NR!=1){for (i=4;i<=NF;i++){if($i != ""){if(s){s=s" "a[i]}else{s=a[i]}}} print $1,$3,s;s=""}else{split($0,a,",")}}' file
2,376
Posted By RudiC
Here's the polished version of my above proposal....
Here's the polished version of my above proposal. Pls. give it a try and comment:
awk -F, 'BEGIN {OFS=FS;fmt="%s"OFS;
aOK=bOK=needa=needb=1;
...
2,376
Posted By raj_saini20
yes it can be done with combination also
yes it can be done with combination also
2,598
Posted By mirni
Try this: awk ' /displayName/ &&...
Try this:

awk '
/displayName/ && $2~/^[0-9][0-9]-/{dt[++cnt]=$2}
/^formattedValue>/{fv=$2; getline; print dt[$2],fv,$2 }
' FS="[><]" RS='><' xmlFile
It assumes that ordinal tag is the next...
2,598
Posted By mirni
awk '/displayName/ && $2~/^[0-9][0-9]-/{print...
awk '/displayName/ && $2~/^[0-9][0-9]-/{print $2}' FS="[><]" RS='><' xmlFile
2,598
Posted By ctsgnb
$ awk -F"</?displayName>" '{for(i=1;++i<=NF;)...
$ awk -F"</?displayName>" '{for(i=1;++i<=NF;) if(length($i)==10) print $i}' yourfile.xml
04-01-2012
20-12-2011
12-12-2011
09-12-2011
Showing results 1 to 20 of 20

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