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
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
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
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
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
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
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 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
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
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
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
LEARN ABOUT X11R4
perlmacos
PERLMACOS(1) Perl Programmers Reference Guide PERLMACOS(1)
NAME
README.macos - Perl under Mac OS (Classic)
SYNOPSIS
This document briefly describes perl under Mac OS (Classic). If you are running perl under Mac OS X, you don't want to be here (unless you
are in the Classic environment under Mac OS X).
When we say "Mac OS" below, we mean Mac OS 7, 8, and 9, and not Mac OS X.
DESCRIPTION
The latest perl source itself builds on Mac OS, with some additional pieces. Support for Mac OS is now in the perl core, and MacPerl is
kept in close sync with regular perl releases.
To build perl for Mac OS (as an MPW tool), you will need the addition of the macos subdirectory, distributed separately. It includes extra
source files, config files, and make files. It also includes extra Mac-specific modules.
To build the MacPerl application, you will also need the macperl directory, which includes the source files for creating the application
itself.
All of this is available from the development site, via HTTP (in the MacPerl Installer, which includes all the source and binaries) and
anonymous CVS.
http://dev.macperl.org/
The source is also in the main perl repository in the macperl branch (the 5.6 source is in the maint-5.6/macperl branch).
You will also need compilers and libraries, all of them freely available. These are linked to from the SourceForge site. Go that site for
all things having to do with MacPerl development.
MacPerl 5.6.1 and later are supported on Mac OS 8.1 and later, for 68040 and PowerPC architectures. The MPW tool may be used on Mac OS
7.5.5 and 68030 computers.
MacPerl 5.2.0r4 is also available, on the CPAN and on SourceForge. It is based on perl 5.004, and works with Mac OS 7.5.5 and 68030 com-
puters.
AUTHOR
perl was ported to Mac OS by Matthias Neeracher <neeracher@mac.com>. It is currently maintained by Chris Nandor <pudge@pobox.com>.
DATE
Last modified 2002.05.02.
perl v5.8.9 2007-11-17 PERLMACOS(1)