LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2015, 11:03 AM   #1
Alkass
Member
 
Registered: Mar 2010
Posts: 47

Rep: Reputation: 0
Extract info and find/count strings from blocks inside text file


Hello

I have a text file which has blocks like
Code:
dir1/dir2/dir3/name_run_number1:
line1_run_number1_part1
line2_run_number1_part2
line3_run_number1_part3...
Each block is separated with a blank line and there is the ":" in the "header" of each one while each block carries the same "number1" after "run_" suffix
What I want to do is for each block, extract the "number1" as shown in the first line and then for the lines below count from 1-20 and give a message if a "partX" line is missing. Any bash or python would be fine

Thanks

Last edited by Alkass; 01-24-2015 at 11:13 AM.
 
Old 01-24-2015, 11:16 AM   #2
Alkass
Member
 
Registered: Mar 2010
Posts: 47

Original Poster
Rep: Reputation: 0
Please ignore this thread - I ve moved it to "Programming" session
 
  


Reply

Tags
bash, python



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
Shell command/script to find duplicate strings in a text file damgar General 4 09-04-2012 01:17 PM
[SOLVED] Need help!!How to extract text in one file as variable then count it in another file? nobtiba Programming 14 01-04-2011 01:37 AM
How to extract text blocks seperated by blank line art84_LV Programming 9 11-17-2009 01:02 AM
Extract certain text info from text file xmrkite Linux - Software 30 02-26-2008 11:06 AM
script to extract blocks of text from many files. gruessle Programming 4 10-19-2007 02:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration