Sponsored Content
Top Forums Shell Programming and Scripting Remove the first match only in a file using sed Post 302914852 by cillmor on Thursday 28th of August 2014 11:27:52 AM
Old 08-28-2014
Thanks Franklin, awk works as expected. Rudi I'm running off Mac OS X 10.8 so see version different. Thanks again
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed over writes my original file (using sed to remove leading spaces)

Hello and thx for reading this I'm using sed to remove only the leading spaces in a file bash-280R# cat foofile some text some text some text some text some text bash-280R# bash-280R# sed 's/^ *//' foofile > foofile.use bash-280R# cat foofile.use some text some text some text... (6 Replies)
Discussion started by: laser
6 Replies

2. Shell Programming and Scripting

sed/awk help to match list of patterns and remove from org file

Hi, From the pattern mentioned below remove lines based on pattern range. Conditions 1 Look For all lines starting with ALTER TABLE and Ending with ; and contains the word MOVE.I wanto to remove these lines from the file sample below. Note : The above pattern list could be found in... (1 Reply)
Discussion started by: rajan_san
1 Replies

3. Shell Programming and Scripting

Insert text file only after the first match with SED

Hello, I'm new in Shell scripting but i should write a script, which inserts the license header out of a txt-File into the files in our Projekt. For the Java classes it runs without Problems but for XML files not. At xml-files i have to put the license Header after the xml-Header (?xml... (1 Reply)
Discussion started by: PhoenixONE
1 Replies

4. Shell Programming and Scripting

SED - Match a line from a File

Hi, I want to match a line which exists in a file. I have written a test script similar to below - The content of the file file.txt would be like this - /usr/bin/1234.xcf /usr/bin/3456.xcf /usr/bin/7897.xcf /usr/bin/2345.xcf out=`sed -n '\/usr\/bin\/7897.xcf/p' file.txt 2>&1`... (3 Replies)
Discussion started by: angshuman_ag
3 Replies

5. Shell Programming and Scripting

Insert few lines above a match using sed, and within a perl file.

Greetings all, I am trying to match a string, and after that insert a few lines above that match. The string is "Version 1.0.0". I need to insert a few lines ONLY above the first match (there are many Version numbers in the file). The rest of the matches must be ignored. The lines I need to... (2 Replies)
Discussion started by: nagaraj s
2 Replies

6. Shell Programming and Scripting

sed print from last occurrence match until the end of file

Hi, i have file f1.txt with data like: CHECK a b CHECK c d CHECK e f JOB_START .... I want to match the last occurrence of 'CHECK' until the end of the file. I can use awk: awk '/^CHECK/ { buf = "" } { buf = buf "\n" $0 } END { print buf }' f1.txt | tail +2Is there a cleaner way of... (2 Replies)
Discussion started by: ysrini
2 Replies

7. Shell Programming and Scripting

Awk-sed help : to remove first and last line with pattern match:

awk , sed Experts, I want to remove first and last line after pattern match "vg" : I am trying : # sed '1d;$d' works fine , but where the last line is not having vg entry it is deleting one line of data. - So it should check for the pattern vg if present , then it should delete the line ,... (5 Replies)
Discussion started by: rveri
5 Replies

8. Shell Programming and Scripting

sed : replace Nth match in a file

I have a situation where a file "config.txt" looks like this Servername: OS: Serername: OS: Servername: OS: .... .... ... Servername: OS: looking for the sed syntax to replace the "Nth" occurrence of Servername (i would apply the same logic to OS as well), want to replace the Nth... (4 Replies)
Discussion started by: alldbest
4 Replies

9. Shell Programming and Scripting

sed to remove newline chars based on pattern mis-match

Greetings Experts, I am in AIX; I have a file generated through awk after processing the input files. Now I need to replace or remove the new-line characters on all lines that doesn't have a ; which is the last character on the line. I tried to use sed 's/\n/ /g' After checking through the... (6 Replies)
Discussion started by: chill3chee
6 Replies

10. Shell Programming and Scripting

Using awk to remove lines from file that match text

I am trying to remove each line in which $2 is FP or RFP. I believe the below will remove one instance but not both. Thank you :). file 12 123 FP 11 10 RFP awk awk -F'\t' ' $2 != "FP"' file desired output 12 11 (6 Replies)
Discussion started by: cmccabe
6 Replies
Mac::AETE::App(3)					User Contributed Perl Documentation					 Mac::AETE::App(3)

NAME
Mac::AETE::App - reads the Macintosh Apple event dictionary from an application. SYNOPSIS
use Mac::AETE::App; use Mac::AETE::Format::Dictionary; $app = App->new("My Application"); $formatter = Dictionary->new; $app->set_format($formatter); $app->read; $app->write; DESCRIPTION
The App module simplifies reading the Apple event dictionary from an application. It will launch the application if necessary to obtain the dictionary. Methods new Example: ($name is the name of the application.) use Mac::AETE::App; use Mac::AETE::Format::Dictionary; $app = App->new($aete_handle, $name); read (Inherited from Mac::AETE::Parser.) Reads the data contained in the AETE resource or handle. Example: $app->read; set_format (Inherited from Mac::AETE::Parser.) Sets the output formatter used during by the 'write' subroutine. Example: $formatter = Dictionary->new; $app->set_format($formatter); copy (Inherited from Mac::AETE::Parser.) Copies all suites from one Parser object into another. Example: $aete2 = Parser->new($aete_handle2, $another_name); $app->copy($aete2); copies the suites from $aete2 into $aete. merge (Inherited from Mac::AETE::Parser.) Merges suites from one Parser object into another. Only the suites that exist in both objects will be replaced. Example: $aete3 = Parser->new($aete_handle2, $another_name); $app->merge($aete3); write (Inherited from Mac::AETE::Parser.) Prints the contents of the AETE or AEUT resource using the current formatter. $app->write; INHERITANCE
Inherits from Mac::AETE::Parser. AUTHOR
David Schooley <dcschooley@mediaone.net> perl v5.10.0 2005-05-16 Mac::AETE::App(3)
All times are GMT -4. The time now is 01:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy