Sponsored Content
Top Forums Shell Programming and Scripting copy, then delete lines in file with sed using a pattern Post 302498852 by Shell_Life on Tuesday 22nd of February 2011 04:20:28 PM
Old 02-22-2011
To copy lines starting with "ABC" into a new file:
Code:
egrep "^ABC" input_file > output_file

To delete lines starting with "ABC" into another file:
Code:
egrep -v "^ABC" input_file > output_file

This User Gave Thanks to Shell_Life For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SED: match pattern & delete matched lines

Hi all, I have the following data in a file x.csv: > ,this is some text here > ,,,,,,,,,,,,,,,,2006/11/16,0.23 > ,,,,,,,,,,,,,,,,2006/12/16,0.88 < ,,,,,,,,,,,,,,,,this shouldnt be deleted I need to use SED to match anything with a > in the line and delete that line, can someone help... (7 Replies)
Discussion started by: not4google
7 Replies

2. Shell Programming and Scripting

sed delete pattern skipping first n lines of file.

I have files of more than 10K lines that I need to delete lines that contain a pattern, but I want to keep the first few lines intact. Can this be done with sed? (7 Replies)
Discussion started by: tkg
7 Replies

3. Shell Programming and Scripting

delete lines in file matching a pattern

I have a text file, a sample of which is as follows: r/- * 0: WINDOWS/Microsoft.NET/Framework/v2.0.50727/ASP.NETWebAdminFiles/Images/headerGRADIENT_Tall.gif r/- * 0: WINDOWS/SoftwareDistribution/Download/cf8ec753e88561d2ddb53e183dc05c3e/backoff.jpg r/- * 0: ... (2 Replies)
Discussion started by: stumpyuk
2 Replies

4. HP-UX

How to delete specific pattern in a file with SED?

I have one file which is having content as following... 0513468211,,,,20091208,084005,5,,2,3699310, 0206554475,,,,20090327,123634,85,,2,15615533 0206554475,,,,20090327,134431,554,,2,7246177 0103000300,,,,20090523,115501,89,,2,3869929 0736454328,,,,20091208,084005,75,,2,3699546... (7 Replies)
Discussion started by: ganesh.mandlik
7 Replies

5. Shell Programming and Scripting

how to delete lines from a file which starts with a specific pattern

I need to delete those lines from a file, which starts with 45. How to do it? (3 Replies)
Discussion started by: mady135
3 Replies

6. Shell Programming and Scripting

sed pattern to delete lines containing a pattern, except the first occurance

Hello sed gurus. I am using ksh on Sun and have a file created by concatenating several other files. All files contain header rows. I just need to keep the first occurrence and remove all other header rows. header for file 1111 2222 3333 header for file 1111 2222 3333 header for file... (8 Replies)
Discussion started by: gary_w
8 Replies

7. Shell Programming and Scripting

sed/awk : how to delete lines based on IP pattern ?

Hi, I would like to delete lines in /etc/hosts on few workstations, basically I want to delete all the lines for a list of machines like this : for HOST in $(cat stations.lst |uniq) do # echo -n "$HOST" if ping -c 1 $HOST > /dev/null 2>&1 then HOSTNAME_val=`rsh $HOST "sed... (3 Replies)
Discussion started by: albator1932
3 Replies

8. Shell Programming and Scripting

Sed delete blank lines upto first pattern match

Hi Im trying to do the following in sed. I want to delete any blank line at the start of a file until it matches a pattern and then stops. for example: Input output: I have got it to work within a range of two patterns with the following: sed '/1/,/pattern/{/^]*$/d}' The... (2 Replies)
Discussion started by: duonut
2 Replies

9. Shell Programming and Scripting

sed search pattern and delete lines

Hello, i have a question. My problem is that i have a file like: TEST JOHN ADAM MICHAEL SEBASTIAN ANDY i want find for MICHAEL and want delete lines like this: TEST (4 Replies)
Discussion started by: eightball
4 Replies

10. Shell Programming and Scripting

sed command to delete a pattern in a file

Hi Everyone, I have an unusual requirement. Here is where i am stuck for sometime now... I have this text file.. lets say .. output.sql... it has lot of entries... here below is part of the entry... .. . . . . . . . . . . . . . . . .... (3 Replies)
Discussion started by: vivek d r
3 Replies
apertium-preprocess-corpus-lextor(1)									      apertium-preprocess-corpus-lextor(1)

NAME
apertium-preprocess-corpus-lextor - This application is part of ( apertium ) This tool is part of the apertium machine translation architecture: http://apertium.org. SYNOPSIS
apertium-preprocess-corpus-lextor data_dir translation_dir input_file output_file DESCRIPTION
apertium-preprocess-corpus-lextor is the application responsible for preprocessing the training corpus for the lexical selector training. OPTIONS
This tool currently has no options. FILES
These are the kinds of files and directories used with this tool: data_dir the path to the linguistic data to use. translation_dir the translation direction to use. input_file contains a large corpus in raw format. output_file The file which gets the preprocessed corpus. SEE ALSO
apertium-gen-lextorbil(1), apertium-gen-lextormono(1), apertium-gen-lextor-eval(1), apertium-gen-stopwords-lextor(1), aper- tium-gen-wlist-lextor(1), apertium-gen-wlist-lextor-translation(1), apertium-lextor(1). BUGS
Lots of...lurking in the dark and waiting for you! AUTHOR
(c) 2005,2006 Universitat d'Alacant / Universidad de Alicante. All rights reserved. 2006-12-12 apertium-preprocess-corpus-lextor(1)
All times are GMT -4. The time now is 06:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy