10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a text file which looks like this
a.txt
A,12,Apple,Red
B,33,Banana,Yellow
C,66,Sky,Blue
I need to search for a particular field(s) in particular column(s) and for that matching line need to replace the nth column.
Sample scenario 1:
Search for 66 in second field and Sky in... (5 Replies)
Discussion started by: wahi80
5 Replies
2. Shell Programming and Scripting
I am passing a variable and replace nth value with the variable.
I tried using many options in awk command but unable to ignore the special characters in the output and also unable to pass the actual value.
Input : "1","2","3"
Output : "1","1000","3"
TempVal=`echo 1000`
Cat... (2 Replies)
Discussion started by: onesuri
2 Replies
3. Shell Programming and Scripting
I wanted to search for a string and replace it with other string from nth column of a file which is comma seperated which I am able to do with below
# For Comma seperated file without quotes
awk 'BEGIN{OFS=FS=","}$"'"$ColumnNo"'"=="'"$PPK"'"{$"'"$ColumnNo"'"="'"$NPK"'"}{print}' ${FileName} ... (5 Replies)
Discussion started by: Amit Joshi
5 Replies
4. Shell Programming and Scripting
Using Awk, how can I achieve the following?
I have set of record numbers, for which, I have to replace the nth field with some values, say spaces.
Eg:
Set of Records : 4,9,10,55,89,etc
I have to change the 8th field of all the above set of records to spaces (10 spaces).
Its a delimited... (1 Reply)
Discussion started by: deepakwins
1 Replies
5. Shell Programming and Scripting
I need to be able to search for a string in the first column and if that string exists than replace the nth column with "-9.99".
AW12000012012 2.38 1.51 3.01 1.66 0.90 0.91 1.22 0.82 0.57 1.67 2.31 3.63 0.00
AW12000012013 1.52 0.90 1.20 1.34 1.21 0.67 ... (14 Replies)
Discussion started by: ncwxpanther
14 Replies
6. Shell Programming and Scripting
Hi,
I need some unix command to replace the following thing.
cat test.dat
1234|test|8/19/2009|8/20/2009|test
1234|test|8/9/2009|8/21/2009|test
1234|test|8/1/2009|8/2/2009|test
after processing
1234|test|08/19/2009|08/20/2009|test
1234|test|08/09/2009|08/21/2009|test... (6 Replies)
Discussion started by: anshaa
6 Replies
7. Shell Programming and Scripting
Is there an awk script that can easily perform the following operation?
I have a data file that is in the format of
1944-12,5.6
1945-01,9.8
1945-02,6.7
1945-03,9.3
1945-04,5.9
1945-05,0.7
1945-06,0.0
1945-07,0.0
1945-08,0.0
1945-09,0.0
1945-10,0.2
1945-11,10.5
1945-12,22.3... (3 Replies)
Discussion started by: ncwxpanther
3 Replies
8. Shell Programming and Scripting
I have an awk script to find the maximum value of the 2nd column of a 2 column datafile, but I need to find the top 5 maximum values of the 2nd column.
Here is the script that works for the maximum value.
awk 'BEGIN { subjectmax=$1 ; max=0} $2 >= max {subjectmax=$1 ; max=$2} END {print... (3 Replies)
Discussion started by: ncwxpanther
3 Replies
9. Shell Programming and Scripting
Hi,
I am looking for any script which can do the following.
have to read a pattern from fileA and copy it to fileB.
fileA:
...
...
Header
...
...
..p1
...
...
fileB:
....
....
Header (3 Replies)
Discussion started by: anilvk
3 Replies
10. Shell Programming and Scripting
hi;
i have a file.txt and its 9th, 10th and 11th line lines are:
RbsLocalCell=S2C1 maxPortIP 4 (this is 9th line)
RbsLocalCell=S3C1 maxPortIP 4 (this is 10th line)
RbsLocalCell=S1C1 ... (11 Replies)
Discussion started by: gc_sw
11 Replies