Find the answer to your Linux question:
Results 1 to 2 of 2
i have a file with data in that looks something like this: Code: 7 213.105.172.13 64.139 ms 51.771 ms 51.922 ms 8 62.253.184.2 52.075 ms 52.214 ms 55.384 ms 9 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241

    Formating Text file or output


    i have a file with data in that looks something like this:

    Code:
     7  213.105.172.13  64.139 ms  51.771 ms  51.922 ms
     8  62.253.184.2  52.075 ms  52.214 ms  55.384 ms
     9  193.159.225.237  49.361 ms  52.573 ms  52.688 ms
    10  217.239.40.173  64.264 ms  64.204 ms  64.795 ms
    11  217.6.48.246  64.797 ms  64.983 ms  65.299 ms
    12  194.126.123.58  77.388 ms  77.950 ms  82.695 ms
    13  194.126.123.53  114.337 ms  126.156 ms  122.287 ms
    14  194.126.123.46  123.318 ms  144.008 ms  141.843 ms
    15  195.250.170.38  142.046 ms  130.792 ms  128.414 ms
    How do i go about making sure that they align up correctly column by column? so that it is easier to read on the eye..
    or if possible, would it be able to export to a openoffice spreadsheet with all data correctly in each shell....

    thanks.

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,167
    Looks like a job for awk. Maybe you could use a printf statement with a fixed field width to print out the fields in columns.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •