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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacing carriage return-new line with just tab char.

Status
Not open for further replies.

redhotchilibanana

Programmer
Jul 13, 2003
3
CA
Hi again guys!

i think this is the stupidest question you'll ever get because im really new with bash and unix and solaris and all these stuffs! anyway, im trying to show a list of login names only from finger command and instead of the usual one column field of login names, i am required to have it tab delimited. I have this command already but i dont know how to replace carriage return/new line with tab.

finger -qf | cut -f1 -d' '

i dont know what command i should pipe next. help me on this again pls.

redhotchilibanana
 
Hi:

Instead of replacing the CR-LF, why not pipe the output of your finger/cut commands to xargs placing all the output on one line. Pipe that to sed replacing the space with a tab:

# all on one line
finger -qf|cut -f1 -d' '|xargs|
sed 's/ /'"$(printf '\011')"'/g'

Regards,

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top