Help me! grep the log file without blank lines in column


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help me! grep the log file without blank lines in column
# 1  
Old 01-21-2010
Question Help me! grep the log file without blank lines in column

Hi,

I have log file like this:

Quote:
11;aaaa;3G;0001;AAAA;11AA
22;bbbb;2G;;BBBB;22BB
33;cccc;3G;0003;CCCC;33CC
44;dddd;2G;;DDDD;44DD
55;eeee;2G;0005;;55EE
i want grep the log file without blank lines in column 4. So the file is become like this :

Quote:
11;aaaa;3G;0001;AAAA;11AA
33;cccc;3G;0003;CCCC;33CC
55;eeee;2G;0005;;55EE
What is the command?
please help me.
# 2  
Old 01-21-2010
Code:
$ awk -F";" '$4' infile
11;aaaa;3G;0001;AAAA;11AA
33;cccc;3G;0003;CCCC;33CC
55;eeee;2G;0005;;55EE

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split file when value in column is blank

Hi Experts, In short : Need to split file when field in column 5 is blank and need to generate two file in which column 5 is blank and other in which column 5 has values along with other rows and column data My issue is i am not able to get header for column from raw file into new file which... (4 Replies)
Discussion started by: as7951
4 Replies

2. Shell Programming and Scripting

To check Blank Lines, Blank Records and Junk Characters in a File

Hi All Need Help I have a file with the below format (ABC.TXT) : ®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790 HDFLJDKJSKJ|KJALKSD02|M|7378439274898 KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999 (cont......) I need to write a script where it will check for : blank lines (between rows,before... (6 Replies)
Discussion started by: chatwithsaurav
6 Replies

3. UNIX for Advanced & Expert Users

Delete blank spaces and blank lines in a file

Hi Gurus, Somebody can say me how to delete blank spaces and blank lines in a file unix, please. Thank you for advanced. (10 Replies)
Discussion started by: systemoper
10 Replies

4. Shell Programming and Scripting

Reform Lines in File without blank lines and spaces

Hello All, I have a file with data as below. Each line consists of 21 fields. I am not able to load them back to the database. 50733339,"834","834 ","005010X279A1","N","Y","007977163","0001 ",30,"2110D ","EB ","EB007 ","2 ","Conditional Required Data Element Miss ing... (3 Replies)
Discussion started by: Praveenkulkarni
3 Replies

5. Shell Programming and Scripting

Looping through only blank lines of a file.

I am sorry if I am posting in wrong thread. Experts, I have 2 files File 1 File 2 line1 line1 | line2 line2 | group 1 line3 line3 | line1 line1 | line2 ... (6 Replies)
Discussion started by: suraj.sheikh
6 Replies

6. Shell Programming and Scripting

Delete blank lines, if blank lines are more than one using shell

Hi, Consider a file named "testfile" The contents of file are as below first line added for test second line added for test third line added for test fourth line added for test fifth line added for test (5 Replies)
Discussion started by: anil8103
5 Replies

7. UNIX for Dummies Questions & Answers

Grep command to remove blank lines

The following grep command grep -v "^$" filename > newfilename does not populate the new file with any data. I see it search the entire input file but the output file never gets filled. Is this not the correct command for what Im looking to do? (2 Replies)
Discussion started by: aispg8
2 Replies

8. Shell Programming and Scripting

Grep: Copy all lines from log file into new file

Hello everyone. I have a log file that contains multiple domains: www.thisdomain.com agent.thisdomain.com that.thisdomain.com I need to copy all of the lines that contain "www.thisdomain.com" from the log and output them into a new file. I've tried everything with little luck. Please help... (3 Replies)
Discussion started by: aberli
3 Replies

9. Shell Programming and Scripting

Blank column in a file.

hi, Please tell me a way in which i can find out all the blank columns in the file which is pipe-delimited.after finding the blank column i want to find the line number. (8 Replies)
Discussion started by: Mohit623
8 Replies

10. Shell Programming and Scripting

Blank Lines - End of file

Hi all I need to strip blank lines from the end of a file. I have searched and found topics on how to strip lines from the entirety of a file - however I need to limit this to only the last 3-4 lines. Any ideas? Thanks (4 Replies)
Discussion started by: saabir
4 Replies
Login or Register to Ask a Question