How to grep space?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to grep space?
# 1  
Old 01-28-2010
How to grep space?

Hi,

I want to know how to grep space.

Eg: input file contains

1565432 432 546
3514432 432 545
6541332 432 354
5464412 565 355
8456145 546 534
5632465 432 654

From this i need output of the lines which has 432 which are bold.

My requirement is whenever 432 comes after a space that line should be taken
# 2  
Old 01-28-2010
Code:
grep ' 432'


Last edited by pludi; 01-28-2010 at 09:21 AM.. Reason: code tags, please...
# 3  
Old 01-28-2010
Code:
awk '$2=="432"'  infile

# 4  
Old 01-28-2010
Code:
grep -w 432 file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to grep the words with space between?

see I have a text like: 27-MAY 14:00 4 aaa 5.30 0.01 27-MAY 14:00 3 aaa 0.85 0.00 27-MAY 14:00 2 aaa 1.09 0.00 27-MAY 14:00 5 aaa 0.03 0.00 27-MAY 14:00... (3 Replies)
Discussion started by: netbanker
3 Replies

2. Shell Programming and Scripting

grep to remove blank space

Hi All, Need help to grep blank and copy to file. I have a file in below format dns1dm06_10, dns2dm02_04, dbidub,10000000c9a46d0c gbpuhci,10000000c948b00a ibtur001,10000000c9a1ccda yubkbtp1,10000000c93fec5b I need to copy to all lines which doesn't have wwn >> no-wwn.txt 1... (2 Replies)
Discussion started by: ranjancom2000
2 Replies

3. Shell Programming and Scripting

Eliminating space constraint in grep

here in the below code just a space between 'Info' and '(' is showing that the patter doesnt match... echo "CREATE TABLE Info (" | grep -i "CREATE TABLE Info (" | wc | awk -F' ' '{print $1}' 1 echo "CREATE TABLE Info (" | grep -i "CREATE TABLE Info (" | wc | awk -F' ' '{print $1}' 0 ... (9 Replies)
Discussion started by: vivek d r
9 Replies

4. Shell Programming and Scripting

grep for a string until instance of a space

Hey guys, I'm having a bit of trouble getting this to work using either sed or grep. It's possible awk might be the ticket I need as well, but my regulat expression skills aren't quite up to the task for doing this. I'm looking to grep for the string ERROR from the following log up until any... (6 Replies)
Discussion started by: terrell
6 Replies

5. Shell Programming and Scripting

Grep empty space and sort

Hi Expert, Kindly request for your expertise in this matter. I have below output: 12.125.124.173,xx1.common.com 12.125.124.174,xx2.common.com 12.125.124.175,xx3.common.com 12.125.124.176, 12.125.124.177, 12.125.124.178, 12.125.124.179,xx4.common.com 12.125.124.180,xx5.common.com... (8 Replies)
Discussion started by: regmaster
8 Replies

6. UNIX for Dummies Questions & Answers

grep until a space

This is probably common knowledge, but I am a beginner at bioinformatics! I want a list of my sequence names, without sequence or any of the free text after the space. This is some example file: >cow|68989024|dbj|AB107582.1| Uncultured bacterium gene for 16S rRNA, partial se quence, clone:... (7 Replies)
Discussion started by: kkohl78
7 Replies

7. Shell Programming and Scripting

Matching white space through Grep

Hello All, I am trying to match white space in patterns through - Grep I tried ] & ] but none of them worked. Then I tried Perl extension '\s' and it worked. So just wanted to know if ] & ] are still supported or have they become deprecated. However they have been mentioned in the... (3 Replies)
Discussion started by: paragkalra
3 Replies

8. Shell Programming and Scripting

grep : search a long char contain space

Hi, i have to search for a char like that : export var1="i am not happy /not happy" with a command like : grep $var1 file but this not working with me !!! thank you in advance. (2 Replies)
Discussion started by: tizilfin
2 Replies

9. Shell Programming and Scripting

To grep multiple patterns with space in between them......

Hii... Every One...... I want to grep multiple patterns with space in between them. For eg : I have a file which contains following : red cat every one new one you are an ox take one Now, what I want to do is to grep " you are" , "an ox" and "red cat" from this file. Any help........ (5 Replies)
Discussion started by: prashantshukla
5 Replies

10. UNIX for Dummies Questions & Answers

Change field separator of grep from : to space

Hi, All, I wonder how to change the field separator of grep from : to space when use grep to display. for example when I use grep -e 'pattern1' -e 'pattern2' -n filename to find patterns, it use : to separate patterns, but I want to use blank space. is there an option I can set to... (2 Replies)
Discussion started by: Jenny.palmy
2 Replies
Login or Register to Ask a Question