10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello All,
I am writing a shell script with following requirement:
1. I have one input file as below
CHE01,A,MSC,INO
CHE02,B,NST,INC
CHE03,C,STM,INP
2. In shell script I have predefined array as below:
Array1={A, B, C}
Array2= {U09, C04, A054} (6 Replies)
Discussion started by: angshuman
6 Replies
2. 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
3. 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
4. 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
5. Shell Programming and Scripting
Have Pipe Delimited File:
> BRYAN BAKER|4/4/2015|518 VIRGINIA AVE|TEST
> JOE BAXTER|3/30/2015|2233 MockingBird RD|ROW2On 3rd column where the address is located, I want to add a space after every numeric value - basically doing a "s//&\ / ":
> BRYAN BAKER|4/4/2015|5 1 8 VIRGINIA AVE|TEST
> JOE... (5 Replies)
Discussion started by: svn
5 Replies
6. Shell Programming and Scripting
I am trying to search a given text in a file and find its last occurrence index. The task is to append the searched index in the same file but in a separate column. I am able to accomplish the task partially and looking for a solution.
Following is the detailed description:
names_file.txt
... (17 Replies)
Discussion started by: tarun.trehan
17 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
I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work.
Brief overview:
I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Discussion started by: crownedzero
14 Replies
10. 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