Print only certain lines from a text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print only certain lines from a text file
# 1  
Old 06-01-2005
Print only certain lines from a text file

Hi all,

I have a text file and I want to clean up the file by only print those lines start with the date. Is there anyway I can do that?

Code:
[?25h[?4l[?1l[?3h[?3h
                                                                                                              Wed Jun 1 2005 10:44AM
                                                                                                                              Page 1
                                                                SCAD                                                                
                                                     Location Log Recall Report                                                     
                                         Tue May 31 2005 12:00AM to Tue May 31 2005 11:59PM                                         
 __________________________________________________________________________________________________________________________________ 
|                                                                                                                                  |
| Locations: 656 SCAD FY101                         Transactions: Valid    Transaction Type: All            Reader Status: Online  |
|__________________________________________________________________________________________________________________________________|
|        |       |T|          |Reader|                   |                    |                     |M|O|O|                | Trans |
|  Date  | Time  |P| Location | Name |     ID Number     |  Cardholder Name   |       Action        |N|F|K|     Reason     |Amount |

 __________________________________________________________________________________________________________________________________ 
|05/31/05|02:55PM|1|FY101     |FY101A|000756582          |Perez, Luz Marina   |SUMMER VALIDATIONS   | | |Y|                |       |
|05/31/05|02:55PM|1|FY101     |FY101A|000756582          |Perez, Luz Marina   |SUMMER VALIDATIONS   | | |Y|                |       |
|05/31/05|02:56PM|1|FY101     |FY101A|000756582          |Perez, Luz Marina   |SUMMER VALIDATIONS   | | |Y|                |       |
|05/31/05|02:59PM|1|FY101     |FY101A|                   |                    |No Sale              | | |Y|                |       |
|05/31/05|02:59PM|1|FY101     |FY101A|000756582          |Perez, Luz Marina   |SUMMER VALIDATIONS   | | |Y|                |       |
|05/31/05|03:29PM|1|FY101     |FY101A|                   |                    |No Sale              | | |Y|                |       |
|05/31/05|05:21PM|1|FY101     |FY101A|000668279          |MCNEAL,CORVET J.    |SUMMER VALIDATIONS   | | |Y|                |       |

 __________________________________________________________________________________________________________________________________ 

                                                          Blackboard Inc.                                                        End












































[?3l


Thanks

CT
# 2  
Old 06-01-2005
Code:
egrep -e '(AM\||PM\|)' input.txt > output.txt

djp
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies

2. Shell Programming and Scripting

awk to print lines based on text in field and value in two additional fields

In the awk below I am trying to print the entire line, along with the header row, if $2 is SNV or MNV or INDEL. If that condition is met or is true, and $3 is less than or equal to 0.05, then in $7 the sub pattern :GMAF= is found and the value after the = sign is checked. If that value is less than... (0 Replies)
Discussion started by: cmccabe
0 Replies

3. UNIX for Dummies Questions & Answers

Extracting lines from a text file based on another text file with line numbers

Hi, I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Discussion started by: evelibertine
1 Replies

4. UNIX for Dummies Questions & Answers

print multiple lines from text file based on pattern list

I have a text file with a list of items/patterns: ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig12238 ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig34624... (1 Reply)
Discussion started by: Oyster
1 Replies

5. Shell Programming and Scripting

Print lines between two lines after grep for a text string

I have several very large file that are extracts from Oracle tables. These files are formatted in XML type syntax with multiple entries like: <ROW> some information more information </ROW> I want to grep for some words, then print all lines between <ROW> AND </ROW>. Can this be done with AWK?... (7 Replies)
Discussion started by: jbruce
7 Replies

6. Shell Programming and Scripting

print lines AFTER lines cointaining a regexp (or print every first and fourth line)

Hi all, This should be very easy but I can't figure it out... I have a file that looks like this: @SRR057408.1 FW8Y5CK02R652T length=34 AGCAGTGGTATCAACGCAGAGTAAGCAGTGGTAT +SRR057408.1 FW8Y5CK02R652T length=34 FIIHFF6666?=:88@@@BBD:::?@ABBAAA>8 @SRR057408.2 FW8Y5CK02TBMHV length=52... (1 Reply)
Discussion started by: kmkocot
1 Replies

7. Shell Programming and Scripting

print string at the end of lines in text file

hello, I go text file like this E:/DDD/Dyndede/wwww E:/DDD/sss.com/ffffg/fff E:/DDD/vvvvvv/dd E:/DDD/sss.com/bbbbbb E:/DDD/sss.com/nnnn/xxI want to print /alpha.jpg at the end of every lines like that E:/DDD/Dyndede/wwww/alpha.jpg E:/DDD/sss.com/ffffg/fff/alpha.jpg... (8 Replies)
Discussion started by: davidkhan
8 Replies

8. Shell Programming and Scripting

[bash help]Adding multiple lines of text into a specific spot into a text file

I am attempting to insert multiple lines of text into a specific place in a text file based on the lines above or below it. For example, Here is a portion of a zone file. IN NS ns1.domain.tld. IN NS ns2.domain.tld. IN ... (2 Replies)
Discussion started by: cdn_humbucker
2 Replies

9. Shell Programming and Scripting

Search text from a file and print text and one previous line too

Hi, Please let me know how to find text and print text and its previous line. Please don't get irritated few days back I asked text and next line. I am using HP-UX 11.11 Thanks for your help. (6 Replies)
Discussion started by: kamranjalal
6 Replies

10. Shell Programming and Scripting

How to print the lines after 2nd line from text file

Hi All, I need to print the lines after 2nd line irrespective of the number of lines in file if the file contents are like below ---------- root:!:0:0::/root:/usr/bin/ksh daemon:!:1:1::/etc: bin:!:2:2::/bin: sys:!:3:3::/usr/sys: adm:!:4:4::/var/adm: uucp:!:5:5::/usr/lib/uucp:... (6 Replies)
Discussion started by: ram1729
6 Replies
Login or Register to Ask a Question