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!

Simple AWK question

Status
Not open for further replies.

santhas

Technical User
Aug 27, 2003
35
AU
Hi AWK gurus,

What is the quick way to print a file containing values
1
2
3
4
5
to as
1:2:3:4:5

Thanks
San
 
Code:
awk 'NR>1 {printf ":"} {printf $0} END {print ""}'

For every line excluding the first, print a ":" prefix.

For every line including the first, print the value without a carriage return.

At the end print a carriage return.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top