10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Dear Unix Gurus,
input:
A|1|2|3|4|5
B|1|2|3|4|3
C|1|2|3|4|1
D|1|9|3|4|12
output:
A_(5);B(3);C(1)|1|2|3|4
D_(12)|1|9|3|4
Details:
If $2, $3, $3, $5 are identical, concatenate $1 and associated $NF together in the first field.
But I am trying to do the above by passing the identical... (6 Replies)
Discussion started by: beca123456
6 Replies
2. Shell Programming and Scripting
Hy!
I need to post-process some data files which have variable (and periodic) number of fields. For example, I need to square (data -> data*data) the folowing data file: -5.34281E-28 -3.69822E-29 8.19128E-29 9.55444E-29 8.16494E-29 6.23125E-29
4.42106E-29 2.94592E-29 1.84841E-29 ... (5 Replies)
Discussion started by: radudownload
5 Replies
3. Shell Programming and Scripting
Hi,
I am trying to do this:-
FILE=application.log
PID=12345
FILE=`echo $FILE | awk -F "." '{print $1 "$PID" $2}'`
echo $FILE
application$PIDlog
I need the output to be application12345.log but I am not sure how to get the $PID variable into the output. I have tried various things... (3 Replies)
Discussion started by: sniper57
3 Replies
4. Shell Programming and Scripting
done. (1 Reply)
Discussion started by: myaa02
1 Replies
5. Shell Programming and Scripting
hey,
just want to ask how to do this.
ex.
g="hi i am john"
h=`echo $g | awk '{print $2}'`
echo $h
OUTPUT is 'i'
What if I want to use a variable instead of using '2', how do I do that?
Because this one does not work:
a=2
h=`echo $g | awk '{print ${$a}}'`
this one also does not... (3 Replies)
Discussion started by: h0ujun
3 Replies
6. Shell Programming and Scripting
I have list of files:
ls
a.pdf
b.pdf
c.pdf
and so on...
and I have a file like this:
cat file1
apple
mango
pear
and so on...
I want to rename my file like this: (7 Replies)
Discussion started by: zorrox
7 Replies
7. Shell Programming and Scripting
:b:Hi All,
I have a part of a script below:
var1="value1"
awk 'BEGIN {printf("%36s \n ","value1")}'
Instead of directly giving the "value1" , I need to give using "var1" in the above awk statement.
Is this possible?
If so, what is the modified awk command?
Thanks in advance
JS (1 Reply)
Discussion started by: jisha
1 Replies
8. Shell Programming and Scripting
hi,
i have store variable in $var i want to print it in $3 of file using awk.
how can i do it?
file :
var1,var2,var3
var5,var6,var7
var8,var9,var10
.
.
.
i want to print $var in $3 ( for example var3 or var7 or var10)
thanks (3 Replies)
Discussion started by: kamel.seg
3 Replies
9. Shell Programming and Scripting
i want to print the column file using awk or cut in dynamic manner
like
trmp=2;temp1=1;temp3=2
awk 'BEGIN{OFS=IFS="\t"} {print $temp,$temp1,$temp3}' client_data.txt
or cut -f $temp1,$temp2,$temp3 -d"\t" file_name .
but it is showing error , In awk can i use variable as in printing... (36 Replies)
Discussion started by: jambesh
36 Replies
10. Shell Programming and Scripting
i read the variable ph from file and i wanna to print it in awk.
example
ph=`cat tmpbatch`
tail h.txt|grep "| |"|awk -F"|" '{ print "@unpdx.sql",$5 }'"$ph"
i try this but it does not work (8 Replies)
Discussion started by: kazanoova2
8 Replies