The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script required to get a required info from file. Pls. help me. ntgobinath Shell Programming and Scripting 2 05-31-2008 08:34 AM
transforming small javascript into perl marringi UNIX for Dummies Questions & Answers 9 05-01-2008 07:01 AM
Querying, Constructing, and Transforming XML with XQuery iBot Oracle Updates (RSS) 0 04-06-2008 05:10 AM
Help required on file formating udiptya UNIX for Dummies Questions & Answers 1 01-31-2008 09:25 AM
transforming a multiline record to single line anju Shell Programming and Scripting 9 01-14-2008 07:55 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-15-2008
anju anju is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore
Posts: 17
Help Required In Transforming A File

How will i convert a file

<LREC><L:EPOCH>1198331268.553</L:EPOCH><LDATE>10-12-07</LDATE><L:SERVER>NONE</L:SERVER><L:PORT>NONE</L:PORT><LTIME>13:47:48.553</LTIME><LTEXT>dnvdmxk</LTEXT></LREC>
<LREC><L:EPOCH>1198331268.553</L:EPOCH><LDATE>10-12-07</LDATE><L:SERVER>NONE</L:SERVER><L:PORT>NONE</L:PORT><LTIME>13:47:48.553</LTIME><LTEXT>dnvdmxk</LTEXT></LREC>
<LREC><L:EPOCH>1198331268.553</L:EPOCH><LDATE>10-12-07</LDATE><L:SERVER>NONE</L:SERVER><L:PORT>NONE</L:PORT><LTIME>13:47:48.553</LTIME><LTEXT>dnvdmxk</LTEXT></LREC>

to this
<LDATE>10-12-07</LDATE><LTIME>13:47:48.553</LTIME><LTEXT>dnvdmxk</LTEXT>
<LDATE>10-12-07</LDATE><LTIME>13:47:48.553</LTIME><LTEXT>dnvdmxk</LTEXT>
<LDATE>10-12-07</LDATE><LTIME>13:47:48.553</LTIME><LTEXT>dnvdmxk</LTEXT>

Basically i want some portions of a file to be merged and form a new file

anju
  #2 (permalink)  
Old 01-15-2008
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,509
Code:
sed 's/.*\(<LDATE>.*<\/LDATE>\).*\(<LTIME>.*<\/LTIME>\).*\(<LTEXT>.*<\/LTEXT>\).*/\1\2\3/g' "file"
  #3 (permalink)  
Old 01-15-2008
anju anju is offline
Registered User
  
 

Join Date: Jan 2008
Location: Bangalore
Posts: 17
Smile

Quote:
Originally Posted by ghostdog74 View Post
Code:
sed 's/.*\(<LDATE>.*<\/LDATE>\).*\(<LTIME>.*<\/LTIME>\).*\(<LTEXT>.*<\/LTEXT>\).*/\1\2\3/g' "file"
thank you so much...!!!!! it worked
  #4 (permalink)  
Old 01-15-2008
Nagabhushan Nagabhushan is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 12
you can do like this by cut :
ex
input is your file
cut -c 40-62 ch1-ch2 ch3-ch4input
<LDATE>10-12-07</LDATE>
<LDATE>10-12-07</LDATE>
<LDATE>10-12-07</LDATE>
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On




All times are GMT -4. The time now is 10:13 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0