Seeking help with search


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Seeking help with search
# 8  
Old 11-01-2014
Quote:
Originally Posted by Scrutinizer
Try:
Code:
sed -n '/Field 3/{N;/1234567890/p;}' file*

This worked as well.

Thanks.

---------- Post updated at 11:31 PM ---------- Previous update was at 11:25 PM ----------

Quote:
Originally Posted by Scrutinizer
Yes but that is equivalent to (GNU) grep -C 1 and it will show 3 lines per match instead of two..

You're right. But since the search string appeared in both Field 3 and 4, I needed to pull both before and after lines. I could've used the command below to get just the two files i needed:

Code:
grep -B 1 1234567890 file

# 9  
Old 11-01-2014
Quote:
Originally Posted by bbbngowc
[..]But since the search string appeared in both Field 3 and 4, I needed to pull both before and after lines. I could've used the command below to get just the two files i needed:

Code:
grep -B 1 1234567890 file

Only when 1234567890 occurs in field 4, not when it occurs in field 3
# 10  
Old 11-01-2014
Quote:
Originally Posted by Scrutinizer
Only when 1234567890 occurs in field 4, not when it occurs in field 3
Correct.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Seeking Alternative for diff in hp

Hi , I have to use HP-unix OS to get difference between 2 files.while i tried a piece of code in other OS(linux/unix) as below, it worked fine & the output is desired one. diff --suppress-common-lines -y file_1 file_2 >d.txt The same doesn't works in HP -unix. Any help shall be... (6 Replies)
Discussion started by: vinil
6 Replies

2. Shell Programming and Scripting

[grep] seeking more than one word

Hello everybody, How can I do seek several words with grep command ? I didn't find how to do that in the man for I'm French. Then I tried man bash | grep -in control flow But flow is interpreted as an input file Then I tried man bash | grep -in "control" -a "flow" but doesn't seem to work... (4 Replies)
Discussion started by: Oddant
4 Replies

3. Programming

Seeking Some libs for AIX 5.3

hello everybody! I m compiling some program with the g++ on AIX 5.3 and it needs some library that i didn't find them i am new with the AIX here is the compilation error : g++ -Daix -fpic -o printps -lxercesc1_1 -L/oracle/OraHome/lib32/ -L/epost2/blitz/lib -lhmltods -lhmltops -lgeneric... (0 Replies)
Discussion started by: eternalflame
0 Replies

4. Shell Programming and Scripting

seeking help with shell script

I am trying to update a script which I had created to monitor tablespace usage. Originally the sql spooled out to a text file anything with more than 75% used. I have been asked to change this. Now the sql must spool out all tablespaces. The script I have to write should scan the file for... (4 Replies)
Discussion started by: Niadh
4 Replies

5. UNIX for Dummies Questions & Answers

Seeking help...Urgent!!! Please help me...

Can any1 please help me answer a couple of this question? 1) What is the process management of UNIX? (single task, multitasks, etc...) 2) What is the process management of Linux? (single task, multitasks, etc...) 3) What is the type of process of UNIX? (process, thread, etc...) 4)... (1 Reply)
Discussion started by: blind02002
1 Replies

6. UNIX for Dummies Questions & Answers

Seeking UNIX documentation

Hi, I am looking for documentation (PDF, DOC, books, web ...) about UNIX scripts. What could you advice me ? Thanks. (3 Replies)
Discussion started by: Filippo
3 Replies

7. Shell Programming and Scripting

awk: seeking to bytes

can I seek to a particular byte in a file and replace it using awk? if so, how? (8 Replies)
Discussion started by: karyn1617
8 Replies

8. UNIX for Dummies Questions & Answers

Control Panel seeking.

Hi, guys. My friends and I used to rent space from our ISP, and they applied Cpanel to help us to config. Recently we just upgrade to the dedicated server plan, and there is nothing but only the os has been installed. Since Cpanel is the commercial software, we cannot afford it, we need to find a... (2 Replies)
Discussion started by: HOUSCOUS
2 Replies

9. Filesystems, Disks and Memory

seeking a doc on lvm etc...

Hi. I wanted to increase my knowledge base with unix. can you help me find a like that talks about luns, physical volumes, volume groups, logical volumes then mountpoints? i would appreciate it thanks Jigar (1 Reply)
Discussion started by: jigarlakhani
1 Replies
Login or Register to Ask a Question