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

  Unix/Linux 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 Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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 Unix and Linux 12-12-2012
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 24 February 2015, 2:15 PM EST
Location: Galactic Empire
Posts: 3,401
Thanks: 240
Thanked 1,215 Times in 1,141 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image 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 12:12 PM
In Sed how can I replace starting from the 7th character to the 15th character. mohullah Shell Programming and Scripting 5 09-22-2010 09:39 PM
SED: Can't Repeat Search Character in SED Output rhetoric101 UNIX for Dummies Questions & Answers 8 09-17-2009 03:33 PM
Let my introduce myself and one doubt!!!! webquinty UNIX for Dummies Questions & Answers 1 10-01-2008 08:45 AM
how to introduce delay in the script??(urgent) wrapster Shell Programming and Scripting 10 03-25-2008 01:35 PM



All times are GMT -4. The time now is 12:45 PM.