Concatenate lines in file shell script


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Concatenate lines in file shell script
# 1  
Old 01-14-2012
Concatenate lines in file shell script

Hi colleagues,
I have a file in this format.
Code:
"/cccc/pppp/dddd/ggg/prueba.txt".
ERROR"  THE error bbbbbbbbbb finish rows.
"/kkkk/mmmm/hhhh/jjj/ejemplo.txt".
ERROR This is other error rows.

I need my file in this format.
Code:
"/cccc/pppp/dddd/ggg/prueba.txt". ERROR"  THE error bbbbbbbbbb finish rows.
"/kkkk/mmmm/hhhh/jjj/ejemplo.txt". ERROR This is other error rows.

Somebody can say me how to do this jobs?
Thank you for you help.

Last edited by methyl; 01-14-2012 at 01:27 PM.. Reason: please use code tags
# 2  
Old 01-14-2012
Hi,
already tried to google for it?
linux - Concatenate Lines in Bash - Stack Overflow

see ya
fra
# 3  
Old 01-14-2012
@systemoper
Please mention what Operating System and version you have and what Shell you prefer.
Is your example data representative?
# 4  
Old 01-14-2012
Code:
while read line
do
   read line2
  echo "$line" "$line2" 
done <inputfile

This User Gave Thanks to jgt For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

2. Shell Programming and Scripting

What is the function of the following lines at the top of a shell script file: Directory and Script?

The file starts like this: Directory: <path to the script> Script: <script fife name> #!bin/ksh ##Comments <actual script> What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this,... (4 Replies)
Discussion started by: remytom
4 Replies

3. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

4. Shell Programming and Scripting

[Solved] Script to concatenate 2 files with the same number of lines

Hi everyone, I have two files, namely: file1: file1Col1Row1;file1Col2Row1;file1Col3Row1 file1Col1Row2;file1Col2Row2;file1Col3Row2 file1Col1Row3;file1Col2Row3;file1Col3Row3file2: file2Col1Row1;file2Col2Row1;file2Col3Row1 file2Col1Row2;file2Col2Row2;file2Col3Row2... (0 Replies)
Discussion started by: gacanepa
0 Replies

5. UNIX for Advanced & Expert Users

Concatenate output in shell script

Hi Colleagues, I need the help in the followind. I execute this. select count(*) from schema.tablew the output is this. select count(*) from schema.table 3955 I need the followind output. select count(*) from schema.table 3955 Thank you for you help. (8 Replies)
Discussion started by: systemoper
8 Replies

6. Programming

Concatenate two lines in a fIle

Hi All, Can any one help me in finding the solution for concatenating two or more lines in a file and writing them to a temporary file. for Example: He is a wise student. So he got first rank. This is in a file i want the output as He is a wise student so he got first rank. into a file... (3 Replies)
Discussion started by: uday.sena.m
3 Replies

7. Shell Programming and Scripting

concatenate lines using shell scripting

i have a mega file in this format: a, b, c, d, = a2, b2, c2, d2, = a3, b3 = i want to combine lines until = meet. the result should be : a,b,c,d, a2,b2,c3,d2 a3,b3 (13 Replies)
Discussion started by: dtdt
13 Replies

8. Shell Programming and Scripting

concatenate log file lines up to timestamp

Hi, Using sed awk or perl I am trying to do something similar to https://www.unix.com/shell-programming-scripting/105887-sed-awk-concatenate-lines-until-blank-line-2.html but my requirement is slightly different. What I am trying to accomplish is to reformat a logfile such that all lines... (4 Replies)
Discussion started by: AlanC
4 Replies

9. Shell Programming and Scripting

Help with a shell script to concatenate lists together

Below is a description of what im trying to achieve: Write a shell script to concatenate lists together, and output the resulting list. Do not include any argument that is a sub-list of the entire list. (The script will clean the list of any redundant items.) You must preserve the original order... (1 Reply)
Discussion started by: rfourn
1 Replies

10. Shell Programming and Scripting

How to cut, concatenate data in Shell Script

Hello All,, I'm very new to Unix and I'm more in SAP ABAP. I have a requirement for a shell script which will accept one parameter as Input file name(with directory) e.g : /sapdata/deubank/dbdirect/out/deu01deupe/in/deu01deupe20051207111320.pmt In the shell script I have to make two more... (2 Replies)
Discussion started by: vasan_srini
2 Replies
Login or Register to Ask a Question