Is it possible to introduce a character using sed? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Is it possible to introduce a character using sed?

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-12-2012
siteregsam siteregsam is offline
Registered User
 
Join Date: Jan 2012
Last Activity: 24 December 2012, 1:03 AM EST
Posts: 27
Thanks: 23
Thanked 0 Times in 0 Posts
Is it possible to introduce a character using sed?

I need to reformat a text using sed command like

Text: 160845
Output: 16:08:45

Please help me how this can be done using sed.
Thanks in adv
Sponsored Links
    #2  
Old 12-12-2012
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 20 August 2014, 1:27 PM EDT
Location: Galactic Empire
Posts: 3,361
Thanks: 230
Thanked 1,195 Times in 1,124 Posts

Code:
echo 160845 | sed 's/\(..\)\(..\)/\1:\2:/'
16:08:45

The Following User Says Thank You to Yoda For This Useful Post:
siteregsam (12-12-2012)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Create files to introduce with ZFS herbich1985 Solaris 9 06-04-2012 11:12 AM
In Sed how can I replace starting from the 7th character to the 15th character. mohullah Shell Programming and Scripting 5 09-22-2010 08:39 PM
SED: Can't Repeat Search Character in SED Output rhetoric101 UNIX for Dummies Questions & Answers 8 09-17-2009 02:33 PM
Let my introduce myself and one doubt!!!! webquinty UNIX for Dummies Questions & Answers 1 10-01-2008 07:45 AM
how to introduce delay in the script??(urgent) wrapster Shell Programming and Scripting 10 03-25-2008 12:35 PM



All times are GMT -4. The time now is 12:21 AM.