Sponsored Content
Top Forums Shell Programming and Scripting join lines on line break in files Post 302339605 by mad_man12 on Friday 31st of July 2009 03:18:33 AM
Old 07-31-2009
join lines on line break in files

i had a file where lines appear to be broken when they shouldn't
eg
Line 1. kerl abc sdskd sdsjkdlsd sdsdksd \
Line 2. ksdkks sdnjs djsdjsd

i can do a shift join to combine the lines but i there are plenty of files with this issue
Line 1. kerl abc sdskd sdsjkdlsd sdsdksd ksdkks sdnjs djsdjsd
i need a script that files as input and fix the line break wherever it appears
Please Advice
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Break one line to many lines using awk

Break one line to many lines using awk The below code works but i want to implement without combining field 2 and 3 and then splitting i would like to do this in one command instead of writing multiple commands and creating multiple lines. nawk -F"|" '{print $1,$2SUBSEP$3}' OFS="|" file >... (16 Replies)
Discussion started by: pinnacle
16 Replies

2. Shell Programming and Scripting

Join in a single line variable number of lines

Hi all, I have a file with little blocks beginning with a number 761XXXXXX, and 0, 1, 2 or 3 lines below of it beginning with STUS as follow: 761625820 STUS ACTIVE 16778294 STUS NOT ACTIVE 761157389 STUS ACTIVE 16778294 761554921 STUS ACTIVE 16778294 STUS NOT ACTIVE STUS ACTIVE OP... (4 Replies)
Discussion started by: cgkmal
4 Replies

3. Shell Programming and Scripting

Break lines up into single lines after each space in every line

It sounds a bit confusing but what I have is a text file like the example below (without the Line1, Line2, Line3 etc. of course) and I want to move every group of characters into a new line after each space. Example of text file; line1 .digg-widget-theme2 ul { background: rgb(0, 0, 0) none... (7 Replies)
Discussion started by: lewk
7 Replies

4. Shell Programming and Scripting

join based on line number when one file is missing lines

I have a file that contains 87 lines, each with a set of coordinates (x & y). This file looks like: 1 200.3 -0.3 2 201.7 -0.32 ... 87 200.2 -0.314 I have another file which contains data that was taken at certain of these 87 positions. i.e.: 37 125 42 175 86 142 where the first... (1 Reply)
Discussion started by: jackiev
1 Replies

5. Shell Programming and Scripting

Join fields from files with duplicate lines

I have two files, file1.txt: 1 abc 2 def 2 dgh 3 ijk 4 lmn file2.txt 1 opq 2 rst 3 uvw My desired output is: 1 abc opq 2 def rst 2 dgh rst 3 ijk uvw (2 Replies)
Discussion started by: xan.amini
2 Replies

6. Shell Programming and Scripting

Join lines from two files based on match

I have two files. File1 >gi|11320906|gb|AF197889.1|_Buchnera_aphidicola ATGAAATTTAAGATAAAAAATAGTATTTT >gi|11320898|gb|AF197885.1|_Buchnera_aphidicola ATGAAATTTAATATAAACAATAAAA >gi|11320894|gb|AF197883.1|_Buchnera_aphidicola ATGAAATTTAATATAAACAATAAAATTTTT File2 AF197885 Uroleucon aeneum... (2 Replies)
Discussion started by: pathunkathunk
2 Replies

7. Shell Programming and Scripting

Join common patterns in multiple lines into one line

Hi I have a file like 1 2 1 2 3 1 5 6 11 12 10 2 7 5 17 12 I would like to have an output as 1 2 3 5 6 10 7 11 12 17 any help would be highly appreciated Thanks (4 Replies)
Discussion started by: Harrisham
4 Replies

8. Shell Programming and Scripting

Join two lines into one, but the second line only the last two columns

Hi guys, I hope you are doing well! I have a file and I need to join two lines into one, but the second line I need only the last two columns. ================= "eHealth Trend Report","logoRpt" "LAN/WAN Group 123" "Divide by Time" "switch1_a-RH-Serial0" "BW: 1.02 M" ... (4 Replies)
Discussion started by: antoniorajr
4 Replies

9. Shell Programming and Scripting

Enumerate lines until each line break using awk

Hi, I have the following data: This this DT 0.99955 0 4 is be VBZ 1 5 7 sentence sentence NN 0.916667 8 16 one one NN 0.545078 17 20 . . Fp 1 20 21 This this DT 0.99955 22 26 is be VBZ 1 27 29 the the DT 1 30 33 second 2 JJ 0.930556 34 40 sentence sentence NN 0.916667 41 49... (1 Reply)
Discussion started by: owwow14
1 Replies

10. Shell Programming and Scripting

Break line content into multiple lines using delimiter

I need to break the line after every 3rd semi colon(;) using Unix shell scripting Input.txt ABC;DEF;JHY;LKU;QWE;BVF;RGHY; Output.txt ABC;DEF;JHY; LKU;QWE;BVF; RGHY; (1 Reply)
Discussion started by: meet_calramz
1 Replies
SGMLDIFF(1)															       SGMLDIFF(1)

NAME
sgmldiff - Find differences in the markup of two SGML files SYNOPSIS
sgmldiff [ options ... ] file1 file2 [ -a | --attributes | -c [ attributes | nesting | textpos ] | --context [ attributes | nesting | textpos ] | -s | --statistics | -h | --help | -v | --version ] DESCRIPTION
This perl script allows to determine the structural differences between two SGML files. It compares the files, regardless of what is in between the tags, to only focus on the markup. Its output is similar to diff(1). The typical use of sgmldiff is to compare an SGML file with its translation into another language. If the translation was done cleanly, sgmldiff returns without finding any difference in the markup. An example of a typical call to sgmldiff is: sgmldiff english.sgml italiano.sgml If there are differences in markup between both files, sgmldiff will output a series of differences reports summarized with lines of the form: 169a164 At line 169 of the first file, line 164 of the second file has been added. 8a12,15 At line 8 of the first file, lines 12 to 15 of the second file have been added. 41d28 Line 41 of the first file has been destroyed, to obtain line 28 of the second file. 63,66d61 Lines 63 to 66 of the first file have been destroyed. to obtain line 61 of the second file. 52c51 Line 52 of the first file has been changed into line 51 of the second file. 5,7c8,10 Lines 5 to 7 of the first file have been changed into lines 8 to 10 of the second line. In addition to those summaries, the lines of the first file are shown preceeded by '<' and the lines of the second file are shown preceeded by '>". OPTIONS
Here is the list of actions that can be requested to sgmldiff: [ -a | --attributes ] Include the attribute values in the difference tests. Don't set this value if the attributes are likely to be translated. Set this value if the attributes value shouldn't change between both files. Default is to don't include the attributes in the difference tests. [ -c [ attributes | nesting | textpos ] | --context [ attributes | nesting | textpos ] ] Add more context to the difference. Since every test between the tags is removed before testing the differences, sgmldiff is likely to resynchronize itself at the wrong place, by thinking the location in both files correspond, while it's not true. By adding more context to the compared area, such risk is disminished. The allowed values for the --context option are: attributes Take into account the attribute names. The attribute values are controlled by the attributes option. nesting Take into account the nesting level of all the compared tags. textpos Take into account the position in the text. [ -s | --statistics ] Print some SGML information at the end. [ -h | --help ] Print a short help message and exit [ -v | --version ] Print the version identifier and exit FILES
AUTHORS
Frederik Fouvry Developer of sgmldiff. SEE ALSO
jw(1) conversion from a SGML file to other file formats nsgmls(1) a base component of Jade DSSSL engine http://sources.redhat.com/docbook-tools/ <URL:http://sources.redhat.com/docbook-tools/> the home page of the DocBook tools, a compendium of all tools necessary to process DocBook files, including the DocBook-utils 11 February 2004 SGMLDIFF(1)
All times are GMT -4. The time now is 12:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy