Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


Closed Thread
  Search this Thread
Old 06-22-2006, 04:17 PM   #1
Registered: May 2006
Posts: 46

Rep: Reputation: 15
reading a txt file

Lets say i have a text file named test.txt

It contains
ABC A 123
ABC A 456
ABC A 789
HET A 123
HET A 123
HET A 567
ABC A 123
ABC A 565
ABC A 123
ABC B 123
ABC B 456
ABC B 789
HET B 123
HET B 123
HET B 567
ABC B 123
ABC B 565
ABC B 123
HET 123
HET 123
HET 678

Is there a way for linux to print all the lines between ABC A and TER(Lines 1-10) on this case ?
The file is dynaminc, some files might have a 100 lines and some might have just 5. so head doesnt work. The problem is i dont know the lines where ABC A or TER exists. I am making a php script read the file with a system command. All i know is the first 5 characters which are "ABC A". Linuc should read the file when it reads this and stop reading when it hits the first TER after the ABC A

Any command to do this? Can you use head and tail with a string instead of a file name?
Old 06-22-2006, 05:19 PM   #2
LQ Veteran
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390Reputation: 2390

Please don't ask the same question twice (also known as crossposting, which is against the rules).

Answer is in this thread.
Old 06-22-2006, 07:52 PM   #3
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

Continue this here.

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading from a txt file into a two dimension array in C kponenation Programming 3 11-26-2005 08:04 PM
Reading a txt file in terminal over a network mdlister Programming 5 03-14-2005 08:47 AM
Perl Script Reading a txt file and generate html to be published! kofi Linux - Software 1 09-22-2003 06:12 PM
How to convert a txt file to be a db file in Redhat linux 9? winnie Linux - Newbie 3 06-27-2003 09:33 AM
perl reading pdf,ps,txt j-ray Programming 1 02-04-2003 11:49 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:02 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration