Line Break problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Line Break problem
# 1  
Old 06-26-2012
Line Break problem

Hi All,
Please can you advise/help on the below issue
i did a bcp out of a table, it is having problem of line break such that one line is getting broken in two lines for many records.

Code:
 
eg
Correct format 
Line 1: - 000f00000bfe2c2c    000218310300000000GBP   GBP 734654  10970.35    66505.459999999992  -55535.110000000001 -55535.110000000001 1   1   0002    
183103    00000000    GBP 100 -55535.110000000001 -55535.110000000001 10970.35    66505.459999999992  0   1

However after the bcp in the txt file in many records ( not all) it is appearing as
Line1: -   000f00000bfe2c2c    000218310300000000GBP   
Line 2:-   GBP 734654  10970.35    66505.459999999992  -55535.110000000001 -55535.110000000001 1   1   0002    183103    00000000    GBP 100 -55535.110000000001 
-55535.110000000001 10970.35    66505.459999999992  0   1

Now i know i can do a shift+J at the end of line 1, but since it has more than 1 lakh records the manual effort is too much
Please can advise if any automated script can be written to overcome it takin into account not all records in the file have the problem, some are appearing fine.
Thanks
# 2  
Old 06-26-2012
With the above sample its difficult to guess where the line break shall be. At field 11 or at the number 183103 etc. Can you please provide more details where the line shall be broken?
# 3  
Old 06-26-2012
Line break issue

In short i want to automate this

Search Any line ending with GBP
do a shift+J ( But it brings the follwing line with only space between GBP's)
So delete the space
and then do the tab
# 4  
Old 06-26-2012
Try this,

Code:
awk '/GBP *$/{printf "%s\t",$0;next}{print $0}' Filename

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to break the line to the one above?

Hello everyone! I'm trying to make the below file1 look like file2, can anyone help? Basically I just hit backspace on every line that starts with a number. Thanks! file1: THIS#IS-IT1 4 THIS#IS-IT2 3 THIS#IS-IT3 2 THIS#IS-IT4 1 Result > file2: (4 Replies)
Discussion started by: demmel
4 Replies

2. UNIX for Dummies Questions & Answers

VI Line Break?

So I'm in a Unix class and our assignment was to go into VI and write a script to make this file tree. At the end of it, I'd like it to echo "This is the file tree you've created" then a line break, then . But I'm not sure as to who to do it. Is there a way for when I run it (./filesystem), the... (4 Replies)
Discussion started by: bbowers
4 Replies

3. Shell Programming and Scripting

Break single line in 4

How can i break a single line into 5 lines # joseluiz.silvano; Ramal4846; Sala4121; SetorCorregedoria host DF04488962 { hardware ethernet 00:16:41:68:57:0B; fixed-address 10.100.111.245; } INTO # joseluiz.silvano; Ramal4846; Sala4121; SetorCorregedoria host DF04488962 {... (5 Replies)
Discussion started by: danielldf
5 Replies

4. Shell Programming and Scripting

Line break on word

I have a file that contains the following: ^field LINE_1 data ^field LINE_2 data ^field LINE_3 data ^field LINE_4 data ^field LINE_5 data ... And im looking to do a line break at the end of the number before the text to make it look like this ^field LINE_1 ... (11 Replies)
Discussion started by: darbs121
11 Replies

5. Shell Programming and Scripting

Add line break for each line in a file

I cannot seem to get this to work.. I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application. the file looks like this this is a test that is a test balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies

6. Shell Programming and Scripting

BASH: Break line, read, break again, read again...

...when the lines use both a colon and commas to separate the parts you want read as information. The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

7. Shell Programming and Scripting

Insert line break

Dear All, thanks in advance input file 410530AAANNNNNAAA410530JJJJJJYYYY410530PPPPPAAAAAA........... I want output like 410530AAANNNNNAAA 410530JJJJJJYYYY 410530PPPPPAAAAAA Thanks (10 Replies)
Discussion started by: The_Archer
10 Replies

8. UNIX for Dummies Questions & Answers

Inserting line break where ';' is

I did some past data manipulations using awk so I could join lines in order to use grep. Now that I have newly searched data I need to insert a new line break to use further statistical packages. I have a data base that looks something like this: ... (3 Replies)
Discussion started by: kkohl78
3 Replies

9. Shell Programming and Scripting

TO break a line

hi All, Have a doubt in ksh..Am not familiar with arrays but i have tried out a script.. plzzzzz correct me with the script My i/p File is: (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 192.168.2.2) (Port = 1525) ) ) (CONNECT_DATA = (SID = TESTDB1) ) ) ... (7 Replies)
Discussion started by: aajan
7 Replies

10. Shell Programming and Scripting

Remove Line Break

Dear all, Please advise what approach can remove all line break from a text file? e.g. Source file: A B C Target file: A, B, C Thanks, Rock (5 Replies)
Discussion started by: Rock
5 Replies
Login or Register to Ask a Question