10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
What is an awk command to print only fields with a number in it??
Input file.......
S,S,S,S,S,S,S,S,S
001S,S,S,S,S,S,S,S,S
00219S,23S,24S,43S,47S,S,S,S,S
00319S,10S,23S,41S,43S,47S,S,S,S
00423S,41S,43S,46S,47S,S,S,S,S
00510S,23S,24S,43S,46S,S,S,S,S
00610S,23S,43S,46S,47S,S,S,S,S... (2 Replies)
Discussion started by: garethsays
2 Replies
2. Shell Programming and Scripting
I have the following awk script that I am using to find the max value in the file and print results.
awk 'BEGIN {MAX=-1E100} {for (x=2; x<=NF; x++) if ($x>MAX) {MAX = $x; C1 = $1}} END {print substr(C1,1,11), substr(C1,13,4), substr(C1,18,2), MAX}' ABC*
Input (ABC*)
... (6 Replies)
Discussion started by: ncwxpanther
6 Replies
3. Shell Programming and Scripting
Hi
I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field.
The source file is pipe delimited and looks something like
1|net|ABC Letr1|1530|||
1|net|EXP_1040 ABC|1121|||
1|net|EXP_TG1224|1122|||
1|net|R_North|1123|||... (5 Replies)
Discussion started by: Mudshark
5 Replies
4. Shell Programming and Scripting
I have a string with the following information and want to return the number of entries enclosed by <> in awk
<stdin>: N = 441 <0.369000018/0.569000006> <0.369000018/0.569000006> <0/1> (7 Replies)
Discussion started by: kristinu
7 Replies
5. Shell Programming and Scripting
I am using the popular bash shell.
Under the current interactive shell, i run the script like:
". ./myscript.txt" . After the current shell has finish the script, the shell will continue to work as I did previously. Actually I want the shell can return from the middle of the scripts it is... (1 Reply)
Discussion started by: Bill Zhao
1 Replies
6. Shell Programming and Scripting
Hi All,
Can you please guide me to search a string in a particular column of file and return the line number of the line where it was found using awk. As an example :
abc.txt
7000,john,2,1,0,1,6
7001,elen,2,2,0,1,7
7002,sami,2,3,0,1,6
7003,mike,1,4,0,2,1
8001,nike,1,5,0,1,8... (3 Replies)
Discussion started by: arunshankar.c
3 Replies
7. Shell Programming and Scripting
Hi,
I wrote an awk script to analyse file A.
I call the script with files A and B. File A has lines like:
000000033100001
000000036100001
000000039100001
The first 9 characters are interpreted as a line number;
for each line number found I want to output this line number of file B.
... (13 Replies)
Discussion started by: kpg
13 Replies
8. Shell Programming and Scripting
Hey all UNIX nerds- I've built a shell script which runs pretty well- only I want it to have much better error trapping. (Like the kind I could apply to every shell script I write).
I'm not a UNIX genius, and could really use a bit of help.
The original script goes something like this:
1... (3 Replies)
Discussion started by: stevekerver
3 Replies
9. Shell Programming and Scripting
I've got a configuration file that is filled with xml text statements for example:
<...../>
<...../>
<...../>
<data id="java-options" value="-server -Djava.security.policy..../>
<...../>
<...../>
<...../>
I want to write a korn shell script that will go to this specific line and add a... (2 Replies)
Discussion started by: progkcp
2 Replies
10. Shell Programming and Scripting
I'm trying to insert a single character at position 11 in everyline of a file.
My input file looks like this:
456781 ~Y~12345
456782 ~N~12300
and I want my output to look like this:
45678~1 ~Y~12345
45678~2 ~N~12300
I tried the following awk code, but it's not working:... (3 Replies)
Discussion started by: mmarino
3 Replies