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!

awk to calculate line numbers in hex

Status
Not open for further replies.

hopwon

Technical User
Mar 7, 2007
6
ZA
Hi I need a script that will take a file, number each line in the file and then append the line number on the end of the file in hex. Ideally I want to be able to add a set increment for the number i.e. add 25 onto each line number:

cat map_175_r2.txt|awk 'NR{ $0 $0=++b+24 };{print}'|pg

This doesn't work for me as I need the line number at the END of each line and it also needs to be hex:

echo ""|awk '{ (printf "%x\n",10)}'= A (hex 10)

PLEASE can someone help?

Thanks
 
Yupo Feherke that works!

Thanks you've saved me about a weeks work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top