Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick SED Question

Status
Not open for further replies.

brandteppler

Technical User
Jun 5, 2009
3
US
I need to replace blank spaces 1 or greater with a |
ie:

Have this
-rw------- 1 root root 192 Sep 28 04:45 sh78058
need this:
-rw-------|1|root|root|192|Sep|28|04:45|sh78058

Thanks in advance!!

Brandt
 
Hi

Or this ( insignificantly faster ) :
Code:
tr -s ' ' '|'
Tested with GNU [tt]tr[/tt].

But while you asked thi in the [tt]awk[/tt] forum :
Code:
awk -vOFS='|' '$1=$1'
Tested with [tt]gawk[/tt] and [tt]mawk[/tt].

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top