nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Need help on formating text file

This is a discussion on Need help on formating text file within the Shell scripting forums, part of the Development/Scripting category; My file content are something like this; ACTASS= 802 BASECOS= 279 COSNCHG= 3 CUSCOS= 52 UPLDCOS= 2 ... .. I ...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-27-2009, 11:00 AM
Junior Member
User
 
Join Date: Sep 2009
OS: Debian
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
yogeshverma is on a distinguished road
Smile Need help on formating text file

My file content are something like this;
ACTASS=
802
BASECOS=
279
COSNCHG=
3
CUSCOS=
52
UPLDCOS=
2
...
..

I would like to make it as ;

ACTASS=802
BASECOS=279
COSNCHG=3
CUSCOS=52
UPLDCOS=2
....
.....

could any one please help me on this. I am new to Unix. Thanks in advance for help.
Reply With Quote
  #2 (permalink)  
Old 11-28-2009, 03:36 AM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Posts: 595
Thanks: 61
Thanked 78 Times in 70 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default

Hello,
Please be known I was assisted in this answer. I am learning AWK now. Please use file as the name of your input file.

Code:
server1:~ jasonralph$ awk '{ORS=(/=/)?X:RS}1' file
ACTASS=802
BASECOS=279
COSNCHG=3
CUSCOS=52
UPLDCOS=2
server1:~ jasonralph$

Regards,

Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Shell script to convert log file into a csv formatted text file c00l_chintu Shell scripting 5 10-03-2009 08:14 AM
[Solved] Alphabetize text within a file jaysunn Shell scripting 8 07-02-2009 01:45 PM
Shell Script To change strings / text in a text file jaysunn Shell scripting 1 05-08-2009 05:58 PM
Modify Text in a file maxcell Shell scripting 3 10-25-2008 08:33 PM
Replacing text in a file using awk postyrus Shell scripting 4 05-02-2005 03:31 PM


All times are GMT +5.5. The time now is 08:02 PM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38