LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Closed Thread
 
LinkBack Search this Thread
Old 06-22-2006, 03:17 PM   #1
vidyashankara
Member
 
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
TER
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
TER
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, 04:19 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Hi,

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, 06:52 PM   #3
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 65
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.

http://www.linuxquestions.org/rules.php

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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 07:04 PM
Reading a txt file in terminal over a network mdlister Programming 5 03-14-2005 07:47 AM
Perl Script Reading a txt file and generate html to be published! kofi Linux - Software 1 09-22-2003 05:12 PM
How to convert a txt file to be a db file in Redhat linux 9? winnie Linux - Newbie 3 06-27-2003 08:33 AM
perl reading pdf,ps,txt j-ray Programming 1 02-04-2003 10:49 AM


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

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