10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
can I make grep stop after finding the first occurrence of a regex in a line?
Given:
file with various regex patterns
file to be grep'ed
Sadly some of the regex patterns cannot be limited any further, so grep -Eiof patterns.txt file.txt (GNU grep 2.20) will give me possibly n hits... (4 Replies)
Discussion started by: stresing
4 Replies
2. Shell Programming and Scripting
Hello to everyone,
I have this complex problem and I don't how to do it. I'm not sure if awk could be a good choice to do it or could be easiest in bash or perl.
A kind of introduction would be:
- I have a digit, lets say 3.
- I can expand/spread out the digit 3 to cover all possible... (7 Replies)
Discussion started by: Ophiuchus
7 Replies
3. Shell Programming and Scripting
We are using Red Hat Linux.
I have a flat file with among other things, the following lines, which appear occasionally throughout the file:
Using sed, I delete this line:
L;L;L;L;R;R;R;L;R;L;R;R;R;L;L;L
With:
/^;;;;;*/d
Works fine every time.
However, I cannot delete... (6 Replies)
Discussion started by: bloomlock
6 Replies
4. Shell Programming and Scripting
awk '/abc/{print $2}'
This will show the line contains abc and only show the "two filed"
But I want to the line contains "abc" will only show $2, other line still show.
and I want to know awk's way about not only show the line besides changed line
Thanks (2 Replies)
Discussion started by: yanglei_fage
2 Replies
5. Shell Programming and Scripting
if i want to display the contents of a file between say line number 3 and 10 then i use the following command
sed -n '3,10p' filename
if this 3 was contained in x and 10 was contained in y then how wud this command modified?
sed -n '$x,$yp' filename does not work..please advise (2 Replies)
Discussion started by: arindamlive
2 Replies
6. Solaris
hi working with sed in a shell script
using sed to print a range of lines from a given file
for example to print lines 12-24 from a file
sed 12,24p <filename>
however i need to print the line numbers, alongwith the actual lines
would this be possible at all?
Thanks (1 Reply)
Discussion started by: xinuuser
1 Replies
7. Shell Programming and Scripting
Hi, how will i show every 3rd line of the file.
Ex.
line 1
line 2
line 3
line 4
line 5
line 6
line 7
Output:
line 2
line 5
line 6
tyhanks
---------- Post updated at 03:39 AM ---------- Previous update was at 03:37 AM ---------- (2 Replies)
Discussion started by: kenshinhimura
2 Replies
8. UNIX for Dummies Questions & Answers
Using the vanilla
ps -ef
I noticed that the CMD (or command) line gets cut off after 90 characters
UID PID PPID C STIME TTY TIME CMD
root 6020 3822 0 Jun 19 ? 0:01 ./webservd-wdog -r /export/opt/sows/61sp4 -d /export/opt/sows/61sp4/https-logse
Googling... (4 Replies)
Discussion started by: SixSigma1978
4 Replies
9. Shell Programming and Scripting
I wish to give line number from one point to another in sed command like this
sed -n 1,1000000p file1.txt >file2.txt
but variable line number $x,$x+100000 can i give it cos i tried and it was giving an error any suggestions?/
Thx in advance
AC (2 Replies)
Discussion started by: bezudar
2 Replies
10. UNIX for Dummies Questions & Answers
# echo $PATH
/home/user01/bin:/usr/local/bin:/usr/bin:/bin:/usr/ccs/bin:/usr/ucb:/dist/perl5/bin:/dist/fsf/bin:.:/usr/dt/bin:/etc/dt/tbin:/usr/openwin/bin
how to show the PATH in separate line, ie:
/home/user01/bin
/usr/local/bin
/usr/bin:/bin
/usr/ccs/bin
/usr/ucb
etc...... (2 Replies)
Discussion started by: userking
2 Replies