Sponsored Content
Full Discussion: Add lines with sed or awk
Top Forums Shell Programming and Scripting Add lines with sed or awk Post 302389399 by aydj on Sunday 24th of January 2010 06:22:10 PM
Old 01-24-2010
Add lines with sed or awk

I want to get an output from the input as below:

Input:

Code:
ASDDS14 RXOTX-39-8        AB0991C   TRY1900
AEDFS12 RXOTX-39-9        TK0991C   TRY800
HSVDS11 RXOTX-389-10      LG0991C   TRY1900
BSDDS09 RXOTX-394-0       AA0066A   TRY800

OUTPUT:

Code:
ASDDS14 RXOTS-39-8-0        AB0991C   TRY1900
ASDDS14 RXOTS-39-8-1        AB0991C   TRY1900 
ASDDS14 RXOTS-39-8-2        AB0991C   TRY1900 
ASDDS14 RXOTS-39-8-3        AB0991C   TRY1900 
ASDDS14 RXOTS-39-8-4        AB0991C   TRY1900 
ASDDS14 RXOTS-39-8-5        AB0991C   TRY1900 
ASDDS14 RXOTS-39-8-6        AB0991C   TRY1900    
ASDDS14 RXOTS-39-8-7        AB0991C   TRY1900
AEDFS12 RXOTS-39-9-0        TK0991C   TRY800
AEDFS12 RXOTS-39-9-1        TK0991C   TRY800
AEDFS12 RXOTS-39-9-2        TK0991C   TRY800
AEDFS12 RXOTS-39-9-3        TK0991C   TRY800
AEDFS12 RXOTS-39-9-4        TK0991C   TRY800
AEDFS12 RXOTS-39-9-5        TK0991C   TRY800
AEDFS12 RXOTS-39-9-6        TK0991C   TRY800
AEDFS12 RXOTS-39-9-7        TK0991C   TRY800    
HSVDS11 RXOTS-389-10-0      LG0991C   TRY1900
HSVDS11 RXOTS-389-10-1      LG0991C   TRY1900
HSVDS11 RXOTS-389-10-2      LG0991C   TRY1900
HSVDS11 RXOTS-389-10-3      LG0991C   TRY1900
HSVDS11 RXOTS-389-10-4      LG0991C   TRY1900
HSVDS11 RXOTS-389-10-5      LG0991C   TRY1900
HSVDS11 RXOTS-389-10-6      LG0991C   TRY1900   
HSVDS11 RXOTS-389-10-7      LG0991C   TRY1900   
BSDDS09 RXOTS-394-0-0       AA0066A   TRY800    
BSDDS09 RXOTS-394-0-1       AA0066A   TRY800
BSDDS09 RXOTS-394-0-2       AA0066A   TRY800
BSDDS09 RXOTS-394-0-3       AA0066A   TRY800
BSDDS09 RXOTS-394-0-4       AA0066A   TRY800
BSDDS09 RXOTS-394-0-5       AA0066A   TRY800
BSDDS09 RXOTS-394-0-6       AA0066A   TRY800
BSDDS09 RXOTS-394-0-7       AA0066A   TRY800

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed Add New Lines

Hello, I have a file that has data like this: one two three four five six seven eight nine ten Is there a quick way using sed of nawk to put each word on it's own line? Thanks. (2 Replies)
Discussion started by: bestbuyernc
2 Replies

2. Shell Programming and Scripting

Manipulate lines with sed/awk

Hey All, I need to reorganize a file's text. Here is the source: host John_Doe filename "config.cfg"; hardware ethernet 98:10:3d:13:8f:98; fixed-address 10.10.10.29; } host Jane_Doe filename "config.cfg"; hardware ethernet 98:13:11:fd:5a:57; fixed-address 10.10.5.24; } host... (2 Replies)
Discussion started by: TheBigAmbulance
2 Replies

3. Shell Programming and Scripting

How to remove lines before and after with awk / sed ?

Hi guys, I need to remove the pattern (ID=180), one line before and four lines after. Thanks. (5 Replies)
Discussion started by: ashimada
5 Replies

4. Shell Programming and Scripting

Sed/awk to delete single lines that aren't touching other lines

Hello, I'm trying to figure out how to use sed or awk to delete single lines in a file. By single, I mean lines that are not touching any other lines (just one line with white space above and below). Example: one two three four five six seven eight I want it to look like: (6 Replies)
Discussion started by: slimjbe
6 Replies

5. Shell Programming and Scripting

awk or sed - Convert 2 lines to 1 line

Hi, Just trying to get to grips with sed and awk for some reporting for work and I need some assistance: I have a file that lists policy names on the first line and then on the second line whether the policy is active or not. Policy Name: Policy1 Active: yes Policy... (8 Replies)
Discussion started by: guinch
8 Replies

6. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

7. Shell Programming and Scripting

awk - sed :Help Getting next lines data .

Experts, Can you please help how to get the output that are written just below "bad" calls badcalls nullrecv 439486 54 0 badlen xdrcall dupchecks ... (6 Replies)
Discussion started by: rveri
6 Replies

8. UNIX for Dummies Questions & Answers

sed and awk for long lines

Hi, I'm trying make a variable length file to a fixed length of 4000. I'm to pad spaces on the right of a record if length is less than 4000 to make the record length 4000. I'm trying to use the below commands awk '{printf "%-4000s\n", $0}' inputfile.dat > outputfile.dat sed -e :a... (12 Replies)
Discussion started by: uxusr
12 Replies

9. Shell Programming and Scripting

Join lines using sed or awk

Hi, I have text file that looks like this: blabla bla PATTERN LINE1 LINE2 bla bla bla PATTERN LINE1 LINE2 bla PATTERN LINE1 LINE2 bla (9 Replies)
Discussion started by: hench
9 Replies

10. Shell Programming and Scripting

Add string into certain lines - sed

Hello all, I have surely an easy question - but at the moment I do not see the solution. All what I want is to add the string "/9201" within a file when a line starts with ":47A:". This is how a file look like: Information Tool :12:Delimiter :3:Space :47A:0329 :3:Space After the... (2 Replies)
Discussion started by: API
2 Replies
ldap_open(3LDAP)					      LDAP Library Functions						  ldap_open(3LDAP)

NAME
ldap_open, ldap_init - initialize an LDAP session SYNOPSIS
cc [ flag... ] file... -lldap [ library... ] #include <lber.h> #include <ldap.h> LDAP *ldap_open(const char *host, int port); LDAP *ldap_init(const char *host, int port); DESCRIPTION
The ldap_open() function initializes an LDAP session and also opens a connection to an LDAP server before it returns to the caller. Unlike ldap_open(), ldap_init() does not open a connection to the LDAP server until an operation, such as a search request, is performed. The ldap_open() function is deprecated and should no longer be used. Call ldap_init() instead. A list of LDAP hostnames or an IPv4 or IPv6 address can be specified with the ldap_open() and ldap_init() functions. The hostname can include a port number, separated from the hostname by a colon (:). A port number included as part of the hostname takes precedence over the port parameter. The ldap_open() and ldap_init() functions attempt connections with LDAP hosts in the order listed and return the first suc- cessful connection. PARAMETERS
These functions support the following parameters. host The hostname, IPv4 or IPv6 address of the host that runs the LDAP server. A space-separated list of hostnames can also be used for this parameter. port TCP port number of a connection. Supply the constant LDAP_PORT to obtain the default LDAP port of 389. If a host includes a port number, the default parameter is ignored. RETURN VALUES
The ldap_open() and ldap_init() functions return a handle to an LDAP session that contains a pointer to an opaque structure. The structure must be passed to subsequent calls for the session. If a session cannot be initialized, the functions return NULL and errno should be set appropriately. Various aspects of this opaque structure can be read or written to control the session-wide parameters. Use the ldap_get_option(3LDAP) to access the current option values and the ldap_set_option(3LDAP) to set values for these options. EXAMPLES
Example 1: Specifying IPv4 and IPv6 Addresses LDAP sessions can be initialized with hostnames, IPv4 or IPv6 addresses, such as those shown in the following examples. ldap_init("hosta:636 hostb", 389) ldap_init("192.168.82.110:389", 389) ldap_init("[fec0::114:a00:20ff:ab3d:83ed]", 389) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
errno(3C), ldap(3LDAP), ldap_bind(3LDAP), ldap_get_option(3LDAP), ldap_set_option(3LDAP), attributes(5) SunOS 5.10 15 Jan 2004 ldap_open(3LDAP)
All times are GMT -4. The time now is 02:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy