Sponsored Content
Top Forums Shell Programming and Scripting Grep certain portion from the file Post 302283261 by angheloko on Tuesday 3rd of February 2009 01:38:50 AM
Old 02-03-2009
I would suggest to separate "paragraphs" with a blank line such that the file will look like this:

Code:
Statement Date : Blah blah
Blah blah
Blah blah
Blah blah Blah blah Blah blah Invalid Statement
Blah blah Blah

Statement Date : Blah blah
Blah blah
Blah blah
Blah blah Blah blah Blah blah Invalid Statement
Blah blah Blah

Once the file is in the above format, you can use this:
Code:
sed -e '/./{H;$!d;}' -e 'x;/Invalid Statement/!d;'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove portion of file

Can anyone tell me how to remove a portion of a large file to smaller ones? What I have is a large file that was created becasue several similar files were joined together. Each individual file starts with MSG_HEAD. I want to take everything from MSG_HEAD up to were it says MSG_HEAD again and... (13 Replies)
Discussion started by: methos
13 Replies

2. Programming

Delete Portion of a file

hi i would like to know whether i can delete a part of a file in C for eg. if my file contained 1234567890 and i want to delete 456 so that it becomes 1237890 is there a way i can do this. well, one way i can achieve this is by creating a new file, copy whatever i want, then delete the... (2 Replies)
Discussion started by: sameersbn
2 Replies

3. UNIX for Dummies Questions & Answers

Print a portion of file

Hi, I have a little problem. I am having a file with pattern like : asdf;ffgg;dfjfj;djdfjf;nnjj;djd;ssj; I just want to print the portion from last ";" upto the immediate previous ";". There are several ";" in my line. Please help me out... Thnx in advance (8 Replies)
Discussion started by: vanand420
8 Replies

4. UNIX for Advanced & Expert Users

Grep a portion of the log file

I want to grep a portion of the log file. grepping a particular pattern and including 10 lines before that and after that occurence. grep -n "SomeString Pattern" filename 10 lines before this occurence and 10 lines after that. Please help. Need the simple script not in awk or sed. (9 Replies)
Discussion started by: sainipardeep
9 Replies

5. UNIX for Dummies Questions & Answers

Grab Portion of Output Text (sed, grep, awk?)

Alright, here's the deal. I'm running the following ruby script (output follows): >> /Users/name/bin/acweather.rb -z 54321 -o /Users/name/bin -c Clouds AND Sun 57/33 - Mostly sunny and cool I want to just grab the "57/33" portion, but that's it. I don't want any other portion of the line. I... (5 Replies)
Discussion started by: compulsiveguile
5 Replies

6. Shell Programming and Scripting

How to grep a portion of line

Mysql log has something like: I want to grep only the portion "ernie-1328697839.1233158" from each line. How to do this? (6 Replies)
Discussion started by: proactiveaditya
6 Replies

7. UNIX for Advanced & Expert Users

Removing portion of file name

Hi , I am getting file name like ABC_DATA_CUSTIOMERS_20120617.dat ABC_DATA_PRODUCTS_20120617.dat Need to convert CUSTIOMERS.dat PRODUCTS.dat Help me how to do this. (7 Replies)
Discussion started by: reach_malu
7 Replies

8. Shell Programming and Scripting

Unix Scripting : Sort a Portion of a File and not the complete file

Need to sort a portion of a file in a Alphabetical Order. Example : The user adam is not sorted and the user should get sorted. I don't want the complete file to get sorted. Currently All_users.txt contains the following lines. ############## # ARS USERS ############## mike, Mike... (6 Replies)
Discussion started by: evrurs
6 Replies

9. UNIX for Dummies Questions & Answers

How to append portion of a file content to another file when a certain pattern is matching?

Hi ladies and gentleman.. I have two text file with me. I need to replace one of the file content to another file if one both files have a matching pattern. Example: text1.txt: ABCD 1234567,HELLO_WORLDA,HELLO_WORLDB DCBA 3456789,HELLO_WORLDE,HELLO_WORLDF text2.txt: XXXX,ABCD... (25 Replies)
Discussion started by: bananamen
25 Replies

10. UNIX for Beginners Questions & Answers

How do I separate a portion of a file name to use grep on?

I'm trying to write a script that takes a file name in the form of Name_Num1_Num2.Extension and I want to separate the name portion and then use grep to see if that name part has any illegal characters in it. I already have my grep command written and it works, I'm not sure how to separate the... (5 Replies)
Discussion started by: steezuschrist96
5 Replies
fastautils(1)					     FASTA format file manipulation utilities					     fastautils(1)

NAME
fastautils - FASTA format file manipulation utilities SYNOPSIS
fastachecksum [ options ] <input file> fastaclean fastaclip fastacomposition fastadiff fastaexplode fastafetch fastahardmask fastaindex fastalength fastanrdb fastaoverlap fastareformat fastaremove fastarevcomp fastasoftmask fastasort fastasplit fastasubseq fastatranslate fastavalidcds DESCRIPTION
These are utilities for the manipulation of FASTA format sequence databases which are distributed with the exonerate sequence alignment program. ENVIRONMENT
Not documented yet. EXAMPLES
fastalength sequence.fasta blah blah VERSION
This documentation accompanies version 2.2.0 of the exonerate package. AUTHOR
Guy St.C. Slater. <guy@ebi.ac.uk>. See the AUTHORS file accompanying the source code for a list of contributors. AVAILABILITY
This source code for the exonerate package is available under the terms of the GNU general public licence. Please see the file COPYING which was distrubuted with this package, or http://www.gnu.org/licenses/gpl.txt for details. This package has been developed as part of the ensembl project. Please see http://www.ensembl.org/ for more information. SEE ALSO
exonerate(1),e-PCR fastautils March 2003 fastautils(1)
All times are GMT -4. The time now is 07:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy