Sponsored Content
Top Forums Shell Programming and Scripting Need to remove multiple text from a single file Post 302382947 by Scrutinizer on Sunday 27th of December 2009 11:04:27 AM
Old 12-27-2009
How about:
Code:
egrep -v "^(A|F|K|Y|U|P|B|S|D)" infile

Code:
sed "/^\(A\|F\|K\|Y\|U\|P\|B\|S\|D\)/d" infile

Code:
sed -r "/^(A|F|K|Y|U|P|B|S|D)/d" infile

or in this case:
Code:
sed '/^[AFKYUPBSD]/d' infile

You can leave the caret (^) out if do not only want to delete records that start with a letter but any record that contains a lettter.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read list of filenames from text file and remove these files in multiple directories

I have a large list of filenames from an Excel sheet, which I then translate into a simple text file. I'd like to use this list, which contains various file extensions , to archive these files and then remove them recursively through multiple directories and subdirectories. So far, it looks like... (5 Replies)
Discussion started by: fxvisions
5 Replies

2. Shell Programming and Scripting

Create multiple text file from a single text file on AIX

Hi I need to create multiple text files from onc text file on AIX. The data of text files is as below: ********************************************** ********************************************** DBVERIFY: Release 10.2.0.4.0 - Production on Tue Nov 10 13:45:42 2009 Copyright (c) 1982,... (11 Replies)
Discussion started by: lodhi1978
11 Replies

3. Shell Programming and Scripting

Single to multiple line file

I am working with single line file with 589744523 characters having 542 "^M" (line feed) character. I want to make 542 different lines file from the single line file thr. shell program only (it can be done thr vi command) rd anil sorry for duplicate post previously, actually i don,t know... (6 Replies)
Discussion started by: anil_kut
6 Replies

4. UNIX for Advanced & Expert Users

awk - remove block of text, multiple actions for 'if', inline edit

I'm having a couple of issues. I'm trying to edit a nagios config and remove a host definition if a certain "host_name" is found. My thought is I would find host definition block containing the host_name I'm looking for and output the line numbers for the first and last lines. Using set, I will... (9 Replies)
Discussion started by: mglenney
9 Replies

5. Shell Programming and Scripting

Awk match multiple columns in multiple lines in single file

Hi, Input 7488 7389 chr1.fa chr1.fa 3546 9887 chr5.fa chr9.fa 7387 7898 chrX.fa chr3.fa 7488 7389 chr21.fa chr3.fa 7488 7389 chr1.fa chr1.fa 3546 9887 chr9.fa chr5.fa 7898 7387 chrX.fa chr3.fa Desired Output 7488 7389 chr1.fa chr1.fa 2 3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

6. UNIX for Dummies Questions & Answers

Pdftotext from multiple pdf files to a single text file

I have a directory having a number of pdf files. I want to convert all the files to text, stored in a single text file The following creates multiple text files ls *.pdf | xargs -n1 pdftotext (1 Reply)
Discussion started by: kristinu
1 Replies

7. Shell Programming and Scripting

Remove multiple lines from a text file

Hi I have a text file named main.txt with 10,000 lines. I have another file with a list of line numbers (around 1000) of the lines to be deleted from main.txt file. I tried with sed but it removes only a range of line numbers. Thanks for any help!! (1 Reply)
Discussion started by: prvnrk
1 Replies

8. Shell Programming and Scripting

Execution of loop :Splitting a single file into multiple .dat file

hdr=$(cut -c1 $path$file|head -1)#extract header”H” trl=$(cut -c|path$file|tail -1)#extract trailer “T” SplitFile=$(cut -c 50-250 $path 1$newfile |sed'$/ *$//' head -1')# to trim white space and extract table name If; then # start loop if it is a header While read I #read file Do... (4 Replies)
Discussion started by: SwagatikaP1
4 Replies

9. UNIX for Beginners Questions & Answers

Output file name and file contents of multiple files to a single file

I am trying to consolidate multiple information files (<hostname>.Linux.nfslist) into one file so that I can import it into Excel. I can get the file contents with cat *Linux.nfslist >> nfslist.txt. I need each line prefaced with the hostname. I am unsure how to do this. --- Post updated at... (5 Replies)
Discussion started by: Kentlee65
5 Replies

10. Shell Programming and Scripting

Remove single @ on line from file

Hi All, So I have to remove all the @hostnames from a file, the problem is, there are instances where @ is used for other things... For example: example text: @This is some text in between some at signs@ @This is some more text@ This is a line that will contain a username and his/her... (5 Replies)
Discussion started by: joeg1484
5 Replies
PYTAGS(1)							  [FIXME: manual]							 PYTAGS(1)

NAME
pytags - set and remove tags on media files from filename and options SYNOPSIS
pytags [OPTIONS] file [file...] DESCRIPTION
pytags is a simple, general-purpose tool for setting and removing media file tags. With no options, pytags prints a tag summary for all files specified on the command line. Options can be used to set and remove tags on files. Using --format, it is easy to change or create tags on by parsing metadata from filenames according to an arbitrary format string. This makes it simple to tag files that are consistently named. Additionally, tags can be manipulated directly with the --add, --set, and --remove options. These options are processed in order, so options specified later on the command-line may cause values set by earlier options to be overwritten. These options must appear after the --format, if it is used. OPTIONS
--add=EXPR Append a tag value all files according to EXPR. EXPR should be an expression like "artist=Foo". May be specified multiple times to add multiple values. --format=FORMAT Tag files with metadata extrapolated from filenames using format string FORMAT; see the section called "FORMAT STRINGS". This option must be specified before --add, --set, or --remove. --set=EXPR Set a single tag on all files according to EXPR. EXPR should be an expression like "artist=Foo". May be specified multiple times to set multiple tags. --set cannot be used to specify multiple values for a single tag. To do that, use --remove followed by multiple --add options. --remove=TAG Remove tags named TAG. May be specified more than once to remove multiple tags. -h, --help Show summary of options and exit. -v, --version Show version of program and exit. FORMAT STRINGS
The format string expected by --format is the same as that for pytagsfs. See the pytagsfs manual page for more information. EXAMPLES
Remove the genre tag from all .ogg files in the current directory. $ pytags --remove genre *.ogg Set the artist and album tag on all .mp3 files, and remove the genre tag. $ pytags --set artist=Foo --set album=Bar --remove genre *.mp3 Tag all of the .flac files in the current directory. All such files are assumed to be in the format "tracknum artist - trackname [album].flac". $ pytags --format '%n %a - %t [%l].flac' *.flac BUGS
Please report bugs on launchpad at http://launchpad.net/products/pytagsfs/+bugs. pytags relies on mutagen (the underlying Python tags library) to choose an appropriate tag format for the files being tagged. This cannot currently be overridden. SEE ALSO
pytagsfs(1) AUTHOR
Forest Bond Author. COPYRIGHT
Copyright (C) 2007, 2008, 2009 [FIXME: source] 2009-12-04 PYTAGS(1)
All times are GMT -4. The time now is 08:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy