Sponsored Content
Top Forums Shell Programming and Scripting bash - joining lines in a file Post 302500696 by Cultcha on Tuesday 1st of March 2011 09:43:51 AM
Old 03-01-2011
Hi, thanks for the response, but there are two variables that should match before joining the lines.

The first and the fourth columns have to match.

These will change after one line/two lines/three lines etc... throughout.

Last edited by Cultcha; 03-01-2011 at 10:49 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Joining lines in log file

Hi, I need to develop a script to join multiple three lines in a log file into one line for processing with awk and grep. I looked at tr with no success. The first line contains the date time information. The second line contains the error line. The third line is a blank line. Thanks, Mike (3 Replies)
Discussion started by: bubba112557
3 Replies

2. Shell Programming and Scripting

Joining 2 lines in a file together

Hi guys, I've got a log file which has entries that look like this: ------------------------------------------------------------------------------- 06/08/04 07:57:57 AMQ9002: Channel program started. EXPLANATION: Channel program 'INSCCPQ1.HSMTSPQ1' started. ACTION: None. ... (3 Replies)
Discussion started by: m223464
3 Replies

3. UNIX for Dummies Questions & Answers

Joining lines of a text file using GAWK

sir... am having a data file of customer master., containing some important fields as a set one line after another., what i want is to have one set of these fields(rows) one after another in line.........then the second set... and so on... till the last set completed. ... (0 Replies)
Discussion started by: KANNI786
0 Replies

4. UNIX for Dummies Questions & Answers

JOINING MULTIPLE LINES IN A TEXT FILE USING GAWK

sir... am having a data file of customer master., containing some important fields as a set one line after another., what i want is to have one set of these fields(rows) one after another in line.........then the second set... and so on... till the last set completed. I WANT THE DATA... (0 Replies)
Discussion started by: KANNI786
0 Replies

5. Shell Programming and Scripting

Joining lines in a text file using AWK or SED

Hi All I'm struggling a bit here :( I need a way of joining lines contained in a text file. I've seen numerous SED and AWK examples and none of them seem to be working for me. The text file has 4 lines: DELL1427 DOC 30189342 79 Now bear with me on this one as I'm actually... (4 Replies)
Discussion started by: huskie69
4 Replies

6. Shell Programming and Scripting

Joining lines in a file - help!

I'm looking for a way to join lines in a file; e.,g consider the following R|This is line 1 R|This is line 2 R|This is line 3 R|This is line 4 R|This is line 5 what i want to end up with is R|This is line 1 R|This is line 2 R|This is line 3 R|This is line 4 R|This is line 5 so... (15 Replies)
Discussion started by: Storms
15 Replies

7. Shell Programming and Scripting

joining multi-line file into single lines

Hi, I have a file like mentioned below..For each specific id starting with > I want to join the sequence in multiple lines to a single line..Is there a simple way in awk or sed to do this >ENST00000558922 cdna:KNOWN TCCAGGATCCAGCCTCCCGATCACCGCGCTAGTCCTCGCCCTGCCTGGGCTTCCCCAGAG... (2 Replies)
Discussion started by: Diya123
2 Replies

8. Shell Programming and Scripting

Joining lines in TXT file based on first character

Hi, I have a pipe delimeted text file where lines have been split over 2 lines and I need to join them back together. For example the file I have is similar to the following: aaa|bbb |ccc ddd|eee fff|ggg |hhh I ideally need to have it looking like the following aaa|bbb|ccc ddd|eee... (5 Replies)
Discussion started by: fuji_s
5 Replies

9. Shell Programming and Scripting

Issue in Concatenation/Joining of lines in a dynamically generated file

Hi, I have a file containing many records delimited by pipe (|). Each record should contain 17 columnns/fields. there are some fields having fields less than 17.So i am extracting those records to a file using the below command awk 'BEGIN {FS="|"} NF !=17 {print}' feedfile.txt... (8 Replies)
Discussion started by: TomG
8 Replies

10. Shell Programming and Scripting

Joining especific lines in "2n" lines file

Hi to everybody. I have a "2n" lines file. I would like to create a new file with only "n" lines, each line in the new file formed by the proper odd line of the old file joined with the following even line (separated by a space) of the old file. I'd prefer using sed or bash. -example-... (5 Replies)
Discussion started by: felino
5 Replies
QSUBST(1)						    BSD General Commands Manual 						 QSUBST(1)

NAME
qsubst -- query-replace strings in files SYNOPSIS
qsubst str1 str2 [flags] file [file [...]] DESCRIPTION
qsubst reads its options (see below) to get a list of files. For each file on this list, it then replaces str1 with str2 wherever possible in that file, depending on user input (see below). The result is written back onto the original file. For each potential substitution found, the user is prompted with a few lines before and after the line containing the string to be substi- tuted. The string itself is displayed using the terminal's standout mode, if any. Then one character is read from the terminal. This is then interpreted as follows (this is designed to be like Emacs' query-replace-string): space Replace this occurrence and go on to the next one. . Replace this occurrence and don't change any more in this file (i.e., go on to the next file). , Tentatively replace this occurrence. The lines as they would look if the substitution were made are printed out. Then another character is read and it is used to decide the result as if the tentative replacement had not happened. n Don't change this one; just go on to the next one. ^G Don't change this one or any others in this file, but instead simply go on to the next file. ! Change the rest in this file without asking, then go on to the next file (at which point qsubst will start asking again). ? Print out the current filename and ask again. The first two arguments to qsubst are always the string to replace and the string to replace it with. The options are as follows: -w The search string is considered as a C symbol; it must be bounded by non-symbol characters. This option toggles. ('w' for 'word'.) -! -go -noask Enter ! mode automatically at the beginning of each file. -nogo -ask Negate -go, that is, ask as usual. -cN (Where N is a number.) Give N lines of context above and below the line with the match when prompting the user. -CAN (Where N is a number.) Give N lines of context above the line with the match when prompting the user. -CBN (Where N is a number.) Give N lines of context below the line with the match when prompting the user. -f filename The filename argument is one of the files qsubst should perform substitutions in. -F filename qsubst reads filename to get the names of files to perform substitutions in. The names should appear one to a line. The default amount of context is -c2, that is, two lines above and two lines below the line with the match. Arguments not beginning with a - sign in the options field are implicitly preceded by -f. Thus, -f is really needed only when the file name begins with a - sign. qsubst reads its options in order and processes files as it gets them. This means, for example, that a -go will affect only files named after the -go. The most context you can get is ten lines each, above and below. str1 is limited to 512 characters; there is no limit on the size of str2. Neither one may contain a NUL. NULs in the file may cause qsubst to make various mistakes. If any other program modifies the file while qsubst is running, all bets are off. AUTHORS
der Mouse <mouse@rodents.montreal.qc.ca> BSD
September 4, 1999 BSD
All times are GMT -4. The time now is 05:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy