08-29-2002
How about:
sed -n '/^11/{;p;n;p;q;}'
This assumes that want only the first couplet that starts with 11. To get them all, omit "q;".
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I have a file that contains 1400 lines similar to the one shown below:
NAME=sara, TOWN=southampton, POSTCODE=SO18777, EMAIL=sara@hotmail.com, PASSWORD=asjdflkjds etc etc (note: this is one line).
Each line has the same fields, but on each line they are in a different order. Eg. the line... (2 Replies)
Discussion started by: Saz
2 Replies
2. Shell Programming and Scripting
I would like to pull a column from a file and place it in a variable:
The file would look like this:
N.Korea gibberish garbage
S.Korea gibberish garbage
USA gibberish garbage
Iraq gibberish garbage
Canada gibberish garbage
and items in the first... (8 Replies)
Discussion started by: dangral
8 Replies
3. Shell Programming and Scripting
I saw a few posts close to what i want to do, but they didn't look like they would work exactly.. or I need to think out of the box on this.
I have a file that I keep server stats in for my own performance analysis. this file has the output from many commands in it (uptime, vmstats, ps, swap... (2 Replies)
Discussion started by: MizzGail
2 Replies
4. UNIX for Dummies Questions & Answers
I have AIX 5.1
This may sound like a really dumb question but I have never done this before.
I would like to pull a file off a backup tape and put back on the AIX
is this as simple as as doing a
mount /dev/rmt1
then the file name that is on the tape /dump/rpt/xxxxxx
Do I just copy it... (14 Replies)
Discussion started by: rocker40
14 Replies
5. UNIX for Dummies Questions & Answers
Hi
I have a file called as MSD.DAT. This file is present at a directory on a server.
www.ta.ibhsv.somewhere.com/rahdf/MSD.DAT
Now, I want to get this file from this server to my Linux box. I need to write a script that uses https to get the file.
Please help how to achieve this.
... (3 Replies)
Discussion started by: infyanurag
3 Replies
6. Shell Programming and Scripting
Hi all,
I am fairly new to scripting, but I do try and script as much as possible but the more advanced stuff does tend to boggle my mind a bit.
I am at a bit of a loss with this one.
I get entries in my DNS logs, like the below:
I want to extract only the IP address, without the hashes... (5 Replies)
Discussion started by: codenjanod
5 Replies
7. Shell Programming and Scripting
Hi,
I have a requirment where I need to pull different columns from a .csv file.
Here is the sample of the csv file.
account,item,flag1,flag2,flag3,flag4,flag5,......feed,tran
I will be have a config.txt file which will have the following information.
item,flag5,flag10,feed,tran... (2 Replies)
Discussion started by: akdevula
2 Replies
8. UNIX for Dummies Questions & Answers
Hello all,
I'm working on a general script for something at work. I'm an up-and-comer backup for a Shell Scripter this company has had for 35 years lol. Anyway, I have a config file I'm trying to pull Variables from as the Config File is used for multiple scripts. Does the below make sense and... (7 Replies)
Discussion started by: phunk
7 Replies
9. Shell Programming and Scripting
I'm scanning a list of emails- I need to pull 2 pieces of data, then move to the next file:
Sender's Email Address
Email Date
I need these to be outputted into a single column- separated by a ",". Like this:
Email1's Address, Email1's Date Stamp
Email2's Address, Email2's Date Stamp... (4 Replies)
Discussion started by: sudo
4 Replies
10. Shell Programming and Scripting
I am connecting to another server through sftp. I am running one batch script to pull file from another server. sometimes i am receiving partial files. I am using below commands in batch script.
ls -ltr new.txt
mget new.txt
bye
The file is of 1 MB only.In most of the cases , i received... (6 Replies)
Discussion started by: srinath01
6 Replies
LEARN ABOUT DEBIAN
shtool-subst
SHTOOL-SUBST.TMP(1) GNU Portable Shell Tool SHTOOL-SUBST.TMP(1)
NAME
shtool-subst - GNU shtool sed(1) substitution operations
SYNOPSIS
shtool subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ext]
[-e|--exec cmd] [-f|--file cmd-file] [file] [file ...]
DESCRIPTION
This command applies one or more sed(1) substitution operations to stdin or any number of files.
OPTIONS
The following command line options are available.
-v, --verbose
Display some processing information.
-t, --trace
Enable the output of the essential shell commands which are executed.
-n, --nop
No operation mode. Actual execution of the essential shell commands which would be executed is suppressed.
-w, --warning
Show warning on substitution operation resulting in no content change on every file. The default is to show a warning on substitution
operations resulted in no content change on all files.
-q, --quiet
Suppress warning on substitution operation resulting in no content change.
-s, --stealth
Stealth operation. Preserve timestamp on file.
-i, --interactive
Enter interactive mode where the user has to approve each operation.
-b, --backup ext
Preserve backup of original file using file name extension ext. Default is to overwrite the original file.
-e, --exec cmd
Specify sed(1) command directly.
-f, --file cmd-file
Read sed(1) command from file.
EXAMPLE
# shell script
shtool subst -i -e 's;(c) ([0-9]*)-2000;(c) 1-2001;' *.[ch]
# RPM spec-file
%install
shtool subst -v -n
-e 's;^(prefix=).*;1 $RPM_BUILD_ROOT%{_prefix};g'
-e 's;^(sysconfdir=).*;1 $RPM_BUILD_ROOT%{_prefix}/etc;g'
`find . -name Makefile -print`
make install
HISTORY
The GNU shtool subst command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 2001 for GNU shtool. It was prompted
by the need to have a uniform and convenient patching frontend to sed(1) operations in the OpenPKG package specifications.
SEE ALSO
shtool(1), sed(1).
18-Jul-2008 shtool 2.0.8 SHTOOL-SUBST.TMP(1)