Search Results

Search: Posts Made By: asavaliya
1,720
Posted By vgersh99
must be in a diff path - probably /usr/bin/ksh93...
must be in a diff path - probably /usr/bin/ksh93 - don't have Solaris in front of me.
Try it with /usr/bin/bash...

What Solaris version are you on? Do uname -a
1,132
Posted By RavinderSingh13
Hello asavaliya, Could you please try...
Hello asavaliya,

Could you please try following and let me know if this helps.

awk 'NR==1{for(i=1;i<=NF;i++){split($i, A,"@");B=B?B OFS A[1]:A[1];C=C?C OFS A[2]:A[2]};print B ORS C;next}...
1,907
Posted By RudiC
Try alsoawk '/E_TIM/ {CNT++} ...
Try alsoawk '/E_TIM/ {CNT++}
{LN[CNT]; HD[$1]; MX[CNT,$1]=$2}
END { for (i in HD) printf "%10s", i; print "";
...
1,907
Posted By durden_tyler
In case Perl is an option, here's a program that...
In case Perl is an option, here's a program that does that:


$
$ cat -n f25
1 E_TIM 16,
2 ETE 15,
3 EOND 26,
4 EEC 81,
5 E_1 un,
6 E_2 ...
1,506
Posted By Subbeh
one way of doing it: tac file.xml | awk ' ...
one way of doing it:
tac file.xml | awk '
/vsDataEUtranCellFDD/ {id=1}
/vsDataEUtranFreqRelation/ {id=2}
/vsDataEUtranCellRelation/ {id=3}
/VsDataContainer id/ {sub(/ id=/,"_id_"id"=")}1' |...
1,506
Posted By Subbeh
Replace tac with tail -r or sed '1!G;h;$!d', see...
Replace tac with tail -r or sed '1!G;h;$!d', see if that works
874
Posted By pamu
As per your input.. try this.. awk...
As per your input.. try this..


awk '{if($3 ~ /A=2/ && NF == 5){a++;$(NF+1)=a}}1' file
874
Posted By rdrtx1
awk '$3 == "A=2" {++arr[$2$3]}{printf $0;if...
awk '$3 == "A=2" {++arr[$2$3]}{printf $0;if (arr[$2$3] ~ /./) printf "\t" arr[$2$3]; print "";}' infile
1,232
Posted By in2nix4life
date '+%Y%m%d.%k00' 20121114.1200
date '+%Y%m%d.%k00'

20121114.1200
1,232
Posted By Yoda
COUNTER=1 while [ $COUNTER -lt 48 ] do ...
COUNTER=1

while [ $COUNTER -lt 48 ]
do
file_name=$( date --date='-'"$COUNTER"' hour' +"%Y%m%d.%H00" ); COUNTER=`expr $COUNTER + 1`
touch $file_name
done
1,194
Posted By alister
And, depending on its controlling terminal's...
And, depending on its controlling terminal's settings, it may not be able to write to it either.

If that script needs to run non-interactively, it's stdin, stdout, and stderr must be redirected.
...
1,557
Posted By scottaazz
All in awk: awk '{ $1 = $1 ".txt" ;if...
All in awk:

awk '{ $1 = $1 ".txt" ;if (a[$1]) { a[$1] = a[$1] "\n"; }; a[$1] = a[$1] "Fi Na=" $2 " no=" $3;} END { for (i in a) { print "Hello\nprl\n" a[i] "\nbye\nq" > i } }' A.txt
1,557
Posted By Yoda
for key in `awk ' { print $1 } ' A.txt | sort |...
for key in `awk ' { print $1 } ' A.txt | sort | uniq`
do
echo "Hello\nprl" > ${key}.txt
awk '/'$key'/ { print "Fi Na=" $2 " no=" $3 } ' A.txt >> ${key}.txt
echo "bye\nq"...
1,708
Posted By spacebar
The below code should work with data like in your...
The below code should work with data like in your example:
$ cat A.txt
RL03 RL03_A_1 RL03_B_1 RL03_C_1
RL03 -119.8 -119.5 -119.5
RL07 RL07_A_1 RL07_B_1 ...
1,708
Posted By rdrtx1
also: awk '{ if ($1 in a) ao[ac++]=$1; ...
also:
awk '{
if ($1 in a) ao[ac++]=$1;
a[$1]=$1;
++l[$1];
cnt[$1]=NF - 1;
for (i=2; i<=NF; i++) {
arr[$1 (l[$1]) (i-1)]=$i;
}
}
END {
for (i=0; i<ac; i++) {
...
5,736
Posted By pamu
You can use variables inside awk. ...
You can use variables inside awk.

date_var=$(date +%Y_%m_%d_%H_%M)

nawk -v VM="$date_var" '{ print "Hello_"VM"-"$0}' $A1 > $l1
2,682
Posted By pamu
awk...
awk 'BEGIN{split("_4A_1,_4B_1,_4C_1",a,",")}{s=$0".txt";print "Hi\nWelocme" > s;
for(i=1;i<=3;i++){print "File Name ="$0""a[i]" no=10" > s}
print "Bye" > s}' file

If you want to create in...
1,670
Posted By vgersh99
awk -v f2='X Y Z' 'BEGIN{split(f2,f2a)}...
awk -v f2='X Y Z' 'BEGIN{split(f2,f2a)} {for(i=1;i<NF;i++) print $1,f2a[i], $(i+1)}' myFile
1,670
Posted By pamu
try this not able to run, hope it gives output :)...
try this not able to run, hope it gives output :)


awk '{ for(i=1;i<=3;i++){if(i==1){print $1,"X",$2}else {if (i==2) { print $1,"Y",$3} else{print $1,"Z",$4}}}}' file
1,670
Posted By delugeag
Easy (but you have to add a condition if you want...
Easy (but you have to add a condition if you want to manage lines with only one field):
awk '{for (i=2;i<=NF;i++) {print $1 OFS $i}}' A.txt > B.txt
4,133
Posted By spacebar
Try egrep like this: $ cat file Hello -101...
Try egrep like this:
$ cat file
Hello -101 -102
Hi -101 -102 0
Hello 0 0
Bye -101 -90 0
Final 0 0
Hello -80
$ egrep 'Hello [-0]' file
Hello -101 -102
Hello 0 0
Hello -80
1,297
Posted By Don Cragun
I think we're having a language barrier problem. ...
I think we're having a language barrier problem. Your egrep command line is looking for any line containing any of the following strings in you input file: "ock", "Ock", "oCk", "OCk", "ocK", "OcK",...
1,297
Posted By agama
Does this work? grep -i '(OCK)'...
Does this work?


grep -i '(OCK)' $fileA.txt> $fileB.txt
Guessing that the OP doesn't realise the significance of parens in an ERE.
1,684
Posted By rangarasan
Please check your field positions. Cheers, ...
Please check your field positions.
Cheers,
Ranga:-)
1,361
Posted By Corona688
awk '{ if($3 == $5) $(NF+1)="Yes"; else...
awk '{ if($3 == $5) $(NF+1)="Yes"; else $(NF+1)="No" }' input > output
Showing results 1 to 25 of 61

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