10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I have a directory of files, I can show the number of lines in each file and order them from lowest to highest with:
wc -l *|sort
15263 Image.txt
16401 reference.txt
40459 richtexteditor.txt
How can I also print the number of unique lines in each file?
15263 1401 Image.txt
16401... (15 Replies)
Discussion started by: spacegoose
15 Replies
2. Shell Programming and Scripting
Hi All,
I have a file looks like:
rst:singh:99.0.20-X86 2 rst:ACSI_SIN_SERVICES
rst:singh:99.0.20-X86 2 rst:ACSI_BISI want to wrap 3rd col in one line and add variable value at start and ending of line and I wrote command:
cat file | awk '{print $3}' | xargs > command.txt
sed -e... (1 Reply)
Discussion started by: rakeshtomar82
1 Replies
3. Shell Programming and Scripting
Hi all,
i need help to extract each first line from multiple lines occurrences based on different patterns (name) starting from the fourth lines like follows:-
// header 1 header 2 header 3
// no acc name score rank
//... (2 Replies)
Discussion started by: redse171
2 Replies
4. Shell Programming and Scripting
Hi All
I'm trying to extract the line just above a regexp and all lines after this.
I'm currently doing this in two steps
sed -n -e "/^+---/{g;p;}" -e h oldfile.txt > modified.txt
sed -e "1,/^+---/d" -e "/^$/d" oldfile.txt >>modified.txt
Sample
sometext will be here
sometext will be... (3 Replies)
Discussion started by: Celvin VK
3 Replies
5. Shell Programming and Scripting
Hi,
I have a file, say files_list, as below (o/p of ls -R cmd)
$ cat files_list
/remote/dir/path/to/file:
sub-dir1
sub-dir2
sub-dir3
...
/remote/dir/path/to/file/sub-dir1:
remote_file1.csv.tgz
<blank line 1>
/remote/dir/path/to/file/sub-dir2:
remote_file2.csv.tgz
<blank... (3 Replies)
Discussion started by: dips_ag
3 Replies
6. Shell Programming and Scripting
Hi,
Anyone help me to print the lines from the flat file between 879th line number and 1424th line number.
The 879 and 1424 should be passed as input to the shell script(It should be dynamic).
Can any one give me using sed or awk?
I tried using read, and print the lines..Its taking too... (3 Replies)
Discussion started by: senthil_is
3 Replies
7. Shell Programming and Scripting
abc.dat
tty cpu
tin tout us sy wt id
0 0 7 3 19 71
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.0 133.2 0.0 682.9 0.0 1.0 0.0 7.2 0 79 c1t0d0
0.2 180.4 0.1 5471.2 3.0 2.8 16.4 15.6 15 52 aaaaaa1-xx
I want to skip first 5 line... (4 Replies)
Discussion started by: kchinnam
4 Replies
8. Shell Programming and Scripting
I am on a Solaris 10 x86 system
sample code
before3
before2
before1
group
after1
after2
after3
I want to grab the second line above my regexp
regexp=group
I want to grab ONLY the before2 line
I have numerous sed and awk ways of grabbing X line below the regexp, but no luck... (1 Reply)
Discussion started by: snoman1
1 Replies
9. UNIX for Dummies Questions & Answers
Hello
I have a silly question. I need to grep a match in text file
and then print 5 lines after it.
grep -A 5 .... do it.
OK
The next thing I can not handle is I need each output to be on 1 line
match line2 line3 line4 line5
match line2 line3 line4 line5
etc..
I will really... (10 Replies)
Discussion started by: alekkz
10 Replies
10. UNIX for Dummies Questions & Answers
Good Day,
Im new to scripting especially awk and sed. I just would like to ask help from you guys about a sed command that prints the line immediately after a regexp, but not the line containing the regexp.
sed -n '/regexp/{n;p;}' filename
What if my regexp is 3 word or a sentence. Im... (3 Replies)
Discussion started by: ownins
3 Replies