Fix the breaks


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fix the breaks
# 8  
Old 01-03-2009
Code:
sed -e ':a' -e '$!N' -e '/\nABC/!s/\n //' -e 'ta' -e 'P;D'


Code:
awk 'NR>1 && /^ABC/ {printf "\n%s", $0 ; next } { printf " %s", $0  } END {print eof}'

# 9  
Old 01-04-2009
Thanks for the reply. The AWK script works pretty well but the first record is pushed to one position left leaving a blank at the starting .The output looks like:

' 'ABCTOM NYMANAGER
ABCDAVE NJ' 'PROGRAMMER
ABCJIM CTTECHLEAD
ABCPETERCA' 'HR

and i want the output to be

ABCTOM NYMANAGER
ABCDAVE NJ' 'PROGRAMMER
ABCJIM CTTECHLEAD
ABCPETERCA' 'HR

from the original input file..


please suggest me how to get rid of this issue...Thanks!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Page breaks and line breaks

Hi All, Need an urgent solution to an issue . We have created a ksh file or shell script which generates 1 DAT file. the DAT file contains extract of a select statement . Now the issue is , when we are executing the ksh file , the output is coimng with page breaks and line breaks . We have... (4 Replies)
Discussion started by: Ayaskant
4 Replies

2. Programming

Clean and keep line breaks

Hello, I want to keep line spaces in comments but clean more then 2 after each. Example: $sentence="This is my first sentence This will be in a new row This will be too in a new row but not separated with 3line breaks just with one "; And i want to... (1 Reply)
Discussion started by: AimyThomas
1 Replies

3. Shell Programming and Scripting

How to fix line breaks format text for huge files?

Hi, I need to correct line breaks for huge files (more than 1MM records in a file) and then format it properly. Except the header and trailer, each record starts with 'D'. Requirement:Scan the whole file except the header and trailer records and see if any of the records start with... (19 Replies)
Discussion started by: kikionline
19 Replies

4. UNIX for Dummies Questions & Answers

What breaks inittab

Today there was a situation where processes running from inittab was broken. Can someone help me understand, how to find out, who might have stopped those processes? Or how does it get broken? G (2 Replies)
Discussion started by: ggayathri
2 Replies

5. Shell Programming and Scripting

Help with wc and line breaks

Hi everyone, I have gone through the forum trying to find an answer to this question but was unsuccessful. I am hoping that someone can help me with this please. I am trying to get my script to recognise line breaks from a file and to give me a result for wc of each line. So basically, if you... (7 Replies)
Discussion started by: stargazerr
7 Replies

6. UNIX for Advanced & Expert Users

ping breaks

I have implemented advance routing fo load balancing and a script for and fail over on a Linux machine which run squid and dansguardian for proxying, i have three interfaces on this machine which are 10.201.108.254 eth1 external interface connected to service provider 10.201.109.254 eth2... (0 Replies)
Discussion started by: surfer24
0 Replies

7. Shell Programming and Scripting

If statement breaks when using except include

I'm having an interesting problem, I'm pretty much a linux newbie, and my past 3 hours of google searching is not helping :P So I'm trying to make an autologin script using expect, but whenever I use expect, it breaks everything not explicitly covered under expect. Example, blahblahs added to... (2 Replies)
Discussion started by: SoulDragon
2 Replies

8. Shell Programming and Scripting

any better way to remove line breaks

Hi, I got some log files which print the whole xml message in separate lines: e.g. 2008-10-01 14:21:44,561 INFO do something 2008-10-01 14:21:44,561 INFO print xml : <?xml version="1.0" encoding="UTF-8"?> <a> <b>my data</b> </a> 2008-10-01 14:21:44,563 INFO do something again I want... (3 Replies)
Discussion started by: csmklee
3 Replies

9. Shell Programming and Scripting

Help on page breaks

Hi, I am new to Unix (AIX). I have a header (in a text file) that needs to be wrtitten on all the pages of a result file (text file). After the header is written, data needs to be read from a file A(text file) and inserted to the result file. If the number of lines reaches 80 in a page, page... (1 Reply)
Discussion started by: simhasuri
1 Replies

10. Programming

Page Breaks

Hi, I have a program in Pro*c when I run it I have no problem with the output but when it runs via the at command and except the output has page breaks every 66 lines. I don't want those page breaks to be in the output. any idea? (9 Replies)
Discussion started by: rama71
9 Replies
Login or Register to Ask a Question