Help, awk sed sort


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help, awk sed sort
# 1  
Old 06-25-2009
Help, awk sed sort

Hi,everyone:
I'm new to shell, and now get trouble with some script:
Code:
line=`/usr/xpg4/bin/awk '/^([^\|]*\|){2}'"$CR"'/ {print $0}' ${TIER4FILE}|grep -v 
 
OSNAME=`sed -n ''$LINE'p' $DATALOC/os`
 
sort +1 /tmp/LhasaCRs2 > /tmp/LhasaCRs1

I cannot understand the "{2}" here. My mentor said it meant the second domain, but I tried and I don't think so.

In the second line, I cannot figure out the exact meaning of the script.

In the last line, I searched that "+" is the domain number, but I cannot run "sort" with "+" on my system like that.
Could anybody help? Thanks a lot.
# 2  
Old 06-25-2009
The second line in your code is for printing the "$LINE"th line of the file $DATALOC/os

Check man pages of "sort". for more information on usage of it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Wget, grep, sort, sed in 1 command/script

Hi, I need to join these statements for efficiency, and without having to make a new directory for each batch. I'm annotating commands below. wget -q -r -l1 URL ^^ can't use -O - here and pipe | to grep because of -r grep -hrio "\b\+@\+\.\{2,4\}\+\b" * > first.txt ^^ Need to grep the output... (14 Replies)
Discussion started by: p1ne
14 Replies

2. Shell Programming and Scripting

sed --> sort data by date

Hi, i "tried" to sort data by date. So far, i used sed to take the data from the last and the actual month. Now, after changing the year it is not working properly. i use: GNU bash, version 4.2.45(1)-release (x86_64-suse-linux-gnu) sed -n '/\//p' $Home/../scripte/pd_0.txt y is a... (6 Replies)
Discussion started by: IMPe
6 Replies

3. Shell Programming and Scripting

Want to sort a file using awk & sed to get required output

Hi All, Need Suggestion, Want to sort a file using awk & sed to get required, output as below, such that each LUN shows correct WWPN and FA port Numbers correctly: Required output: 01FB 10000000c97843a2 8C 0 01FB 10000000c96fb279 9C 0 22AF 10000000c97843a2 8C 0 22AF 10000000c975adbd ... (10 Replies)
Discussion started by: aix_admin_007
10 Replies

4. Shell Programming and Scripting

awk sort

input file abc1 abc23 abc12 abc15 output abc1 abc12 abc15 abc23 (9 Replies)
Discussion started by: yanglei_fage
9 Replies

5. Shell Programming and Scripting

Remove duplicate chars and sort string [SED]

Hi, INPUT: DCBADD OUTPUT: ABCD The SED script should alphabetically sort the chars in the string and remove the duplicate chars. (5 Replies)
Discussion started by: jds93
5 Replies

6. Shell Programming and Scripting

Using a combination of sort/cut/grep/awk/join/paste/sed

I have a file and need to only select users that have a shell of “/bin/bash” in the line using awk or sed please help (4 Replies)
Discussion started by: boyboy1212
4 Replies

7. Shell Programming and Scripting

Sort with Awk, sed ....

I want to print out the lines that have the max value in column 3. and count the occurrence of column 1; if there are more than one occurrences, line with highest column 2 value will be printed. I have this data: input: AV 234 25 AV 256 76 AS 421 34 AV 124 76 BD 136 71 BD 241 76 AW... (10 Replies)
Discussion started by: aydj
10 Replies

8. Shell Programming and Scripting

2 problems... sed and sort

Hi everyone! I have a file like that: And I would it like that: I don't know how to keep the first field and sort the second one. I have a second question with sed... to put the variable $VAR at the beginning of the file... But I have an output like this: snork... (3 Replies)
Discussion started by: Castelior
3 Replies

9. Shell Programming and Scripting

Sed with sort doesnt work

Sed with sort doesnt work The below code doesnt work: sed -e '/^$/d' -e 's/,/|/g' | sort -t"|" -k1,1 -u file1 when i seperate them it work but i have to create intermediate file which i dont want to: sed -e '/^$/d' -e 's/,/|/g' file1 > file2 sort -t"|" -k1,1 -u file2 Help... (2 Replies)
Discussion started by: pinnacle
2 Replies

10. Shell Programming and Scripting

how to use sed to sort out this question

root:x:0:0:0000-Admin(0000):/:/sbin/sh rootcsh:x:0:1:0000-Admin(0000):/:/bin/csh nocol:x:6312:630:NOCOL Monitor,,,:/usr/local/lib/nocol-client:/usr/local/bin/bash nobody:x:60001:60001:uid no body:/:/usr/local/bin/bash noaccess:x:60002:60002:uid no access:/:/usr/local/bin/bash... (2 Replies)
Discussion started by: sonicstage
2 Replies
Login or Register to Ask a Question