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

How do I move text to a certain position on a line?

Status
Not open for further replies.

bgreen

Programmer
Feb 20, 2003
185
CA
I don't know how else to explain this problem so I will show examples:

I have various records in a text file. The large space between the 'word' and the date contains both tabs and spaces. I would like to be able to line up my dates. I am having problems doing this. Does any one have some ideas?

ExpASOClm 2002 MAR
ExpActLiab 2002 MAR
ExpCFRProvAdj 2002 MAR
ExpCashDiv 2002 MAR
ExpDClm 2002 MAR
ExpDClmGrpConv 2002 MAR

Please Help....
 
Try this :

awk '{ printf "%-15s %s\n", $1, $2 }' [Name of data file]

Steve
 
nawk '{$1=sprintf("%-15s", $1);print}' myFile.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Thanks. Your solutions worked! Much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top