Sponsored Content
Full Discussion: Help with AWK SED
Top Forums Shell Programming and Scripting Help with AWK SED Post 302589630 by ian_gooch on Thursday 12th of January 2012 09:13:53 AM
Old 01-12-2012
Help with AWK SED

Hi guys,

I have a question regarding AWK or SED.

I have a data file which reads like this;
Code:
1,03005 41460 73215 10018 20000 39990 40092 51035 78782 879// 90850
2,
3,333 41998 55300 20000 83915 85650 90710 91129=
.........

There are about 100 or so lines like this.

What I need to do is to append the line with the = on the end to the line above so the data file reads like this
Code:
1,03005 41460 73215 10018 20000 39990 40092 51035 78782 879// 90850 333 41998 55300 20000 83915 85650 90710 91129=
2,
3,
........

Any ideas guys?

My pc is about to get throw out of the window....Smilie

Cheers,
Ian


Moderator's Comments:
Mod Comment Use code tags please, see PM, thanks.

Last edited by zaxxon; 01-12-2012 at 10:36 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk / sed

I have many messages such as the test message below: 00:00000:00021:2002/05/13 13:57:00.51 ERROR:- Test error, my test error!!! I am writing a script in which I need to get everything from the word "ERROR:-" onwards. I normally use awk for these things, but I am not an expert at it so i am... (6 Replies)
Discussion started by: baileyr1
6 Replies

2. Shell Programming and Scripting

sed,awk

Hi, I know sed is stream text editor and not a bit more than that. Can anyone explain its usage and advantages? How is awk different from sed? I donno i am a bit confused about it. But i have coded in awk and shell. Thanks, Nisha :confused: (7 Replies)
Discussion started by: Nisha
7 Replies

3. UNIX for Advanced & Expert Users

sed in awk ? or nested awk ?

Hey all, Can I put sed command inside the awk action ?? If not then can i do grep in the awk action ?? For ex: awk '$1=="174" { ppid=($2) ; sed -n '/$ppid/p' tempfind.txt ; }' tempfind.txt Assume: 174 is string. Assume: tempfind.txt is used for awk and sed both. tempfind.txt... (11 Replies)
Discussion started by: varungupta
11 Replies

4. UNIX for Advanced & Expert Users

Awk or Sed help

Hi, I have a data file with 5 columns - like this: "20080401 09:43:08.770798 +0100s","TEST 1","R 1","A TEST","Nov 27 2007","1" "20080401 09:43:08.770798 +0100s","THIS IS A TEST","R 2","B TEST","Nov 30 2007","10" "20080401 09:43:08.770798 +0100s","ANOTHER TEST","R 3","B TEST","Nov 05... (7 Replies)
Discussion started by: MrG-San
7 Replies

5. UNIX for Dummies Questions & Answers

sed or awk?

I've got an inventory database with eight columns with things like product name, manufacturer, UPC code, etc. on each line. Our PO (purchase order) number is in the first column. I can grep the date and get the full line of data but I would like to strip out everything but the PO number in the... (5 Replies)
Discussion started by: NetJones
5 Replies

6. Shell Programming and Scripting

Using sed or awk?

What if I wanted to add a word such as IT after the first character and if theres 3 characters, after the 2nd character? output would be: G, it H G, H it P G, H, P it L I'm thinking that AWK would be the easiest way to do this... Currently looking it up. Right now I'm using awk but I... (13 Replies)
Discussion started by: puttster
13 Replies

7. Shell Programming and Scripting

Need help using awk or sed.

Hi All, Is there a way of comparing two columns in the same file and deleting the row if the values of the columns match. I have the sample data file as below. M024900|175309.00|968.00|17 M025001|19861.79|97.90|148 M025002|431.70|159.00|3 M025003|912.30|159.90|6 ... (6 Replies)
Discussion started by: nua7
6 Replies

8. UNIX for Dummies Questions & Answers

sed/awk or help please

I have a file that contain the data below: B1 1 2 3 B2 20 30 40 B3 7 8 B4 100 B5 21 22 23How can I retrieve the data for B1 into a seperate file. (8 Replies)
Discussion started by: bobo
8 Replies

9. Shell Programming and Scripting

Is this possible using SED and AWK?

Dear Geeks, I want to manipulate a file with certain modifications for that using sed or AWK how to do this process for one file i have this type of data. Input File: "Restricted and Reserved names .ANISH",3798,"TEST.CO",1201208,6/16/10 0:00,6/16/13 0:00,,,"CO","2nd"^M "Restricted and... (4 Replies)
Discussion started by: anishkumarv
4 Replies

10. Shell Programming and Scripting

sed and awk giving error ./sample.sh: line 13: sed: command not found

Hi, I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :- ./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies
ipsvd-instruct(5)						File Formats Manual						 ipsvd-instruct(5)

NAME
ipsvd-instruct - format of the ipsvd(8) instructions directory DESCRIPTION
The internet protocol service daemons, ipsvd(7), can be told to read and follow instructions from a directory on incoming connections to the socket they listen on. For mostly static instructions or for performance reasons, it is possible to compile the instructions from a directory into a constant database (cdb) with ipsvd-cdb(8) for faster lookup, and to tell ipsvd(7) to read the instructions from there. MATCHING
On each incoming connection, the ipsvd(7) matches the client's IP address against files in the instructions directory. For example, the IP address a.b.c.d which reverse resolves to moa.bit.smarden.org is matched against the following files in the instructions directory, in this order, first match wins: 1. a.b.c.d 2. a.b.c 3. a.b 4. a If the client's hostname has been successfully looked up in DNS: 5. moa.bit.smarden.org 6. bit.smarden.org 7. smarden.org 8. org And finally the catchall file ``0'' (zero): 9. 0 After successfully matching a client's IP address or hostname against the instructions directory, ipsvd(7) examines the file that matched the IP address or hostname, and acts accordingly: 1. If neither the user's read permission, nor the user's execute permission is set for the file, the connection is closed immediately. 2. If the file has the user's execute permission set, ipsvd(7) reads the contents of the file and runs /bin/sh -c '<contents>' instead of the default program prog given at the command line for this connection. 3. If the file has the user's read permission set, ipsvd(7) reads the contents of the file and interprets each line as an instruction for this connection (see below). If the client's IP address or hostname doesn't match any file in the instructions directory, the default action is taken (the program prog is run to handle the connection). INSTRUCTIONS
If ipsvd(7) is given instructions for an incoming connection, it reads the corresponding file and interprets each line as follows. The file may be empty, meaning that there is no special instruction. Empty lines and lines starting with ``#'' are ignored. +VAR=VALUE environment. If the line starts with a plus (``+''), and the string following the plus contains a ``='', ipsvd(7) puts the string following the plus into the environment before starting prog to handle the connection. If the string following the plus doesn't contain a ``='', ipsvd(7) makes sure that the environment variable with the name string is not set. Cnum[:msg] concurrency. If the line starts with a ``C'', and is followed by a number, the per host concurrency limit for the IP address that initiated the connection is set to this number. If num is zero, per host concurrency limit is disabled. If num is followed by ``:msg'', the message msg is written to this client if possible, if the per host concurrency limit is reached. msg may contain backslash-escaped characters as follows: ``\'' is converted to a single backslash, `` '' is converted to a new line character, and `` '' is converted to a carriage return. On multiple concurrency instructions the last processed concurrency instruction is considered. Not all ipsvd(7)'s support per host concurrency. =hostname[:forward] check hostname. If the line starts with a ``='', and is followed by a hostname, ipsvd(7) looks up the IP addresses for hostname in DNS and checks if the client's IP address matches one of these IP addresses. If so, ipsvd(7) stops processing the instructions here and runs prog. If hostname is followed a colon and forward, ipsvd(7) now examines the file forward and acts accordingly, instead of running prog. All check hostname instructions in forward are ignored. If forward does not exist, the connection is closed. hostname may be ``0'' (zero), matching any IP address. Note: Using check hostname instructions can cause significant delay while responding to connection attempts, caused by DNS lookups. If ipsvd(7) cannot interpret a line, it prints a warning, discards the line, and continues with the next instruction if any. After processing all instructions, ipsvd(7) runs prog. If the file contains at least one check hostname instruction, and none was success- ful, it closes the connection instead of running prog. EXAMPLE INSTRUCTIONS
+MEMORY=20000 This instruction causes the environment variable ``MEMORY'' with the value ``20000'' to be available to the program prog that han- dles the connection. +DEBUG= This instruction adds the variable ``DEBUG'' with an empty value to the environment. +LOGNAME This instructions makes sure that the environment variable ``LOGNAME'' is unset when running prog. C16 Set the per host concurrency to 16. A connection will be closed silently if there are already 16 active connections from this client's IP address. =floyd.dyn.smarden.org:127.0.0.1 Check IP address of the dynamic hostname floyd.dyn.smarden.org. If one of the IP addresses floyd.dyn.smarden.org currently resolves to matches the client's IP address, handle the connection through the file 127.0.0.1 in the instructions directory. SEE ALSO
ipsvd(7), ipsvd-cdb(8), tcpsvd(8), sslsvd(8), udpsvd(8), sslio(8) http://smarden.org/ipsvd/ AUTHOR
Gerrit Pape <pape@smarden.org> ipsvd-instruct(5)
All times are GMT -4. The time now is 09:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy