Find the answer to your Linux question:
Results 1 to 9 of 9
if I write this command for examle Code: find ./ ! -mtime -$input -type f | xargs ls -tg result is Code: -r--r--r-- 1 eaf 7700 May 11 2005 ./.openoffice/LICENSE ...
  1. #1
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31

    How can I convert data to table?

    if I write this command for examle
    Code:
    find ./ ! -mtime -$input -type f | xargs ls -tg
    result is
    Code:
    -r--r--r--    1 eaf          7700 May 11  2005 ./.openoffice/LICENSE
    -r--r--r--    1 eaf          8244 May 11  2005 ./.openoffice/LICENSE.html
    -r--r--r--    1 eaf         13982 May 11  2005 ./.openoffice/README
    -r--r--r--    1 eaf         12714 May 11  2005 ./.openoffice/README.html
    How can I convert data to table, like EXCEL?
    Last edited by devils casper; 08-07-2007 at 06:41 AM. Reason: Added code tags and removed formatting.

  2. #2
    Just Joined! Locomotion's Avatar
    Join Date
    Dec 2005
    Location
    Tasmania AU
    Posts
    6
    Are you writing a script to do this or do you want to open it in OpenOffice?
    If you would like to open the data in OpenOffice Spreadsheet as a table then make sure you output the data into CSV file (Comma Separated Values) and simply open the CSV file in OpenOffice Spreadsheet, it will then open as a table. From what I can see though you are outputting into tabbed spacing in which case you could then import it into a spreadsheet as tabbed values. But in all honesty just make a script and put it into csv, nice, easy, clean and widely supported.

  3. #3
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31
    Quote Originally Posted by Locomotion View Post
    Are you writing a script to do this or do you want to open it in OpenOffice?
    .
    yes I wont to open the output in table like EXCEL but I try to open output data into CSV file but iit does not give me what I wont. I need to put data in table has raw line and colomn line not written like table I wont to be in real tabll(EXCEL)
    and I wont this table to be editable so I can add new colomn in it
    and if ther is acommand to rename title of each colom it will be grate

  4. #4
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    I believe that Excel can export to a tab-delimited file. Can it not import a tab-delimited file?

    And what do you mean it didn't accept a CSV file? I know for a fact that Excel can take in CSV files.
    DISTRO=Arch
    Registered Linux User #388732

  5. #5
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31

    "calc" and "Excel" does not open file probarlyt put All colomn Under one colomn

    Quote Originally Posted by Cabhan View Post
    I believe that Excel can export to a tab-delimited file. Can it not import a tab-delimited file?

    And what do you mean it didn't accept a CSV file? I know for a fact that Excel can take in CSV files.
    there is program can open CSV file in linux whiich is "calc"but it doesnot open it probarly
    it put All colomn Under one colomn


    or exeample
    -r--r--r-- 1 eaf 7700 May 11 2005 ./.openoffice/LICENSE
    -r--r--r-- 1 eaf 8244 May 11 2005 ./.openoffice/LICENSE.html
    -r--r--r-- 1 eaf 13982 May 11 2005 ./.openoffice/README
    -r--r--r-- 1 eaf 12714 May 11 2005 ./.openoffice/README.html
    -rw-r--r-- 1 eaf 567 May 11 2005 ./.openoffice/user/autotext/mytexts.bau
    -rw-r--r-- 1 eaf 976 May 11 2005 ./.openoffice/user/basic/dialog.xlc

    all of this data under one colomn
    and what it shold be SEPERAT like

    "-r--r--r--" in colomn A "1 eaf" in colomn B
    " 7700 " in colomn C "May 11 2005" in colomn D
    "./.openoffice/LICENSE" in colomn E


    even that Excel did not seprat colomn (did not put every colomn data in separat colomn)


    so any solution tothis proplem

  6. #6
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Seperate the fields with a comma, try this:

    Code:
    awk '{printf("%s, %s %s,%s,%s %s %s,%s\n", $1, $2, $3, $4, $5, $6, $7, $8)}' < file > file.csv
    Regards

  7. #7
    Just Joined! Locomotion's Avatar
    Join Date
    Dec 2005
    Location
    Tasmania AU
    Posts
    6
    Quote Originally Posted by Franklin52 View Post
    Seperate the fields with a comma, try this:

    Code:
    awk '{printf("%s, %s %s,%s,%s %s %s,%s\n", $1, $2, $3, $4, $5, $6, $7, $8)}' < file > file.csv
    Regards
    What he said

  8. #8
    Linux Guru
    Join Date
    Nov 2004
    Posts
    6,110
    Quote Originally Posted by alivip View Post
    even that Excel did not seprat colomn (did not put every colomn data in separat colomn)
    The example you gave above is not a CSV file. CSV is [i]Comma[/u] Seperated Values whereas the input you provided is seperated by spaces or tabs. In either case you can specify a fixed width import and define the line breaks when importing or take Franklin52's suggestion which is to insert commas.

  9. #9
    Just Joined!
    Join Date
    Jul 2007
    Posts
    31
    #!/bin/csh -f
    #echo "Enter numbar of day to search for not modify file"
    set directory = $1
    set days = $2
    #find ./ ! -mtime -$days -type f | xargs ls -tg > files_list.csv
    find $directory ! -mtime -$days -type f | xargs ls -tg > files_list.csv
    more files_list.csv

Posting Permissions

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