Sponsored Content
Top Forums Shell Programming and Scripting Join lines with the same start string Post 302560808 by durden_tyler on Saturday 1st of October 2011 10:30:28 AM
Old 10-01-2011
Code:
$
$
$ cat f9
DN11-001 Thats the first line which needs to be
DN11-001 joined with the second line and also to
DN11-001 the third line as they all begin with the same
DN11-001 document number.
DN11-002 The number of lines differ
DN11-002 among the documents.
DN11-005 It can also be just one line.
$
$
$ perl -lne '/^(.*?) (.*)$/;
             if (! defined $x{$1}) {print $k,$v while ($k,$v)=each %x; %x=()}
             $x{$1}.=" $2";
             END {print $k,$v while ($k,$v)=each %x}' f9
DN11-001 Thats the first line which needs to be joined with the second line and also to the third line as they all begin with the same document number.
DN11-002 The number of lines differ among the documents.
DN11-005 It can also be just one line.
$
$
$

tyler_durden
This User Gave Thanks to durden_tyler For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

join two lines together

Hi, I have a file with on one line a uid, and on the next line a date. I am trying to make the to into one line. Here's an example: koppx 20031125 kraan 20031119 sarox 20031107 And this is what i want it to be: koppx;20031125 kraan;20031119 sarox;20031107 I have been trying... (4 Replies)
Discussion started by: tine
4 Replies

2. UNIX for Dummies Questions & Answers

how to join lines

can anyone tell me as "how to join all lines in a file " using a shell script Actually i have many files in a directory and for each file i want to join all the lines using a shell scrip . Thanks in advance!!! (8 Replies)
Discussion started by: glamo_2312
8 Replies

3. Shell Programming and Scripting

join 2 lines

hi all i have sample and i need script to do this /dev/xxx oracle test /dev/sap 9999 000 88 99 i need the out put like this /dev/xxx oracle test /dev/sap 9999 000 88 99 can any one provide me with an idea to solve this problem (8 Replies)
Discussion started by: maxim42
8 Replies

4. Shell Programming and Scripting

Appending string, variable to file at the start and string at end

Hi , I have below file with 13 columns. I need 2-13 columns seperated by comma and I want to append each row with a string "INSERT INTO xxx" in the begining as 1st column and then a variable "$node" and then $2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13 and at the end another string " ; COMMIT;" ... (4 Replies)
Discussion started by: Vaddadi
4 Replies

5. Shell Programming and Scripting

join two lines

I want to join this two lines but only when after him I have nothing or a comma Yes, I know Jonesy, and I'll give him about one more minute. this two lines must become Yes, I know Jonesy, and I'll give him about one more minute. thank you very much (11 Replies)
Discussion started by: thailand
11 Replies

6. Shell Programming and Scripting

Remove lines between the start string and end string including start and end string Python

Hi, I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

7. Shell Programming and Scripting

Join Lines

Hi how do I join files like below in script. Thanks, Ashan there are may line like this in the file. zone name DR_TMP_A_sev1_3eA vsan 200 pwwn 50:00:09:73:f0:16:35:08 pwwn c0:50:76:08:6e:dc:00:16 zone name DR_TMP_A_SVR2_3eA vsan 200 pwwn 50:00:09:73:f0:16:35:08 pwwn... (4 Replies)
Discussion started by: ashanabey
4 Replies

8. Shell Programming and Scripting

awk to remove lines that do not start with digit and combine line or lines

I have been searching and trying to come up with an awk that will perform the following on a converted text file (original is a pdf). 1. Since the first two lines are (begin with) text they are removed 2. if $1 is a number then all text is merged (combined) into one line until the next... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. UNIX for Beginners Questions & Answers

How do delete certain lines alone which are matching with start and end string values in file?

Hi, In my previous post ( How to print lines from a files with specific start and end patterns and pick only the last lines? ), i have got a help to get the last select statement from a file, now i need to remove/exclude the output from main file: Input File format: SELECT ABCD, DEFGH,... (2 Replies)
Discussion started by: nani2019
2 Replies

10. UNIX for Beginners Questions & Answers

How to print lines from a files with specific start and end patterns and pick only the last lines?

Hi, I need to print lines which are matching with start pattern "SELECT" and END PATTERN ";" and only select the last "select" statement including the ";" . I have attached sample input file and the desired input should be as: INPUT FORMAT: SELECT ABCD, DEFGH, DFGHJ, JKLMN, AXCVB,... (5 Replies)
Discussion started by: nani2019
5 Replies
L-DEVICES(5)							File Formats Manual						      L-DEVICES(5)

NAME
L-devices - UUCP device description file DESCRIPTION
The L-devices file is consulted by the UUCP daemon uucico(8) under the direction of L.sys(5) for information on the devices that it may use. Each line describes exactly one device. A line in L-devices has the form: Caller Device Call_Unit Class Dialer [Expect Send].... Each item can be separated by any number of blanks or tabs. Lines beginning with a `#' character are comments; long lines can be continued by appending a `' character to the end of the line. Caller denotes the type of connection, and must be one of the following: ACU Automatic call unit, e.g., autodialing modems such as the Hayes Smartmodem 1200 or Novation ``Smart Cat''. DIR Direct connect; hardwired line (usually RS-232) to a remote system. DK AT&T Datakit. MICOM Micom Terminal switch. PAD X.25 PAD connection. PCP GTE Telenet PC Pursuit. SYTEK Sytek high-speed dedicated modem port connection. TCP Berkeley TCP/IP or 3Com UNET connection. These are mutually exclusive. Note that listing TCP connections in L-devices is superflu- ous; uucico does not even bother to look here since it has all the information it needs in L.sys(5). Device is a device file in /dev/ that is opened to use the device. The device file must be owned by UUCP, with access modes of 0600 or bet- ter. (See chmod(2)). Call_Unit is an optional second device file name. True automatic call units use a separate device file for data and for dialing; the Device field specifies the data port, while the Call_unit field specifies the dialing port. If the Call_unit field is unused, it must not be left empty. Insert a dummy entry as a placeholder, such as ``0'' or ``unused.'' Class is an integer number that specifies the line baud (for dialers and direct lines) or the port number (for network connections). The Class may be preceded by a non-numeric prefix. This is to differentiate among devices that have identical Caller and baud, but are distinctly different. For example, ``1200'' could refer to all Bell 212-compatible modems, ``V1200'' to Racal-Vadic modems, and ``C1200'' to CCITT modems, all at 1200 baud. Similarly, ``W1200'' could denote long distance lines, while ``L1200'' could refer to local phone lines. Dialer applies only to ACU devices. This is the "brand" or type of the ACU or modem. DF02 DEC DF02 or DF03 modems. DF112 Dec DF112 modems. Use a Dialer field of DF112T to use tone dialing, or DF112P for pulse dialing. att AT&T 2224 2400 baud modem. cds224 Concord Data Systems 224 2400 baud modem. dn11 DEC DN11 Unibus dialer. hayes Hayes Smartmodem 1200 and compatible autodialing modems. Use a Dialer field of hayestone to use tone dialing, or hayespulse for pulse dialing. It is also permissible to include the letters `T' and `P' in the phone number (in L.sys) to change to tone or pulse midway through dialing. (Note that a leading `T' or `P' will be interpreted as a dialcode!) hayes2400 Hayes Smartmodem 2400 and compatible modems. Use a Dialer field of hayes2400tone to use tone dialing, or hayes2400pulse for pulse dialing. novation Novation ``Smart Cat'' autodialing modem. penril Penril Corp ``Hayes compatible'' modems (they really aren't or they would use the hayes entry.) rvmacs Racal-Vadic 820 dialer with 831 adapter in a MACS configuration. va212 Racal-Vadic 212 autodialing modem. va811s Racal-Vadic 811s dialer with 831 adapter. va820 Racal-Vadic 820 dialer with 831 adapter. vadic Racal-Vadic 3450 and 3451 series autodialing modems. ventel Ventel 212+ autodialing modem. vmacs Racal-Vadic 811 dialer with 831 adapter in a MACS configuration. Expect/Send is an optional Expect/Send script for getting through a smart port selector, or for issuing special commands to the modem. The syntax is identical to that of the Expect/Send script of L.sys. The difference is that the L-devices script is used before the connection is made, while the L.sys script is used after. FILES
/etc/uucp/L-devices /etc/uucp/UUAIDS/L-devices L-devices example SEE ALSO
uucp(1), uux(1), L.sys(5), uucico(8) 4.3 Berkeley Distribution October 22, 1996 L-DEVICES(5)
All times are GMT -4. The time now is 12:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy