Search Results - JustLinux Forums


Search:

Type: Posts; User: ghostdog74

Page 1 of 2 1 2

Search: Search took 0.03 seconds.

  1. Replies
    5
    Views
    19,545

    if your purpose is really to just do a directory...

    if your purpose is really to just do a directory listing, i suggest you use modules that comes with Python instead. For doing a listing , use the os.listdir() method, or os.walk(). check the docs....
  2. try this ls -1 | xargs file i leave you...

    try this



    ls -1 | xargs file

    i leave you to do the counting part....
  3. show a sample of how your email file looks like

    show a sample of how your email file looks like
  4. Replies
    1
    Views
    745

    awk -F"|" '{ one[NR] = $2; two[NR] = $3 } END {...

    awk -F"|" '{ one[NR] = $2; two[NR] = $3 }
    END {
    for (i = 1; i <= NR; i++) {
    printf("%s|", one[i])
    }
    print ""
    for (i = 1; i <= NR; i++) {
    ...
  5. unless absolutely necessary, my advice, is to try...

    unless absolutely necessary, my advice, is to try to write "portable" code. for your example, the ls command is specific to the shell and is not found elsewhere, eg windows. If you are going to...
  6. Replies
    4
    Views
    1,899

    I had always thought to reference array elements...

    I had always thought to reference array elements you use $ instead of @?
    eg $data[0] ?? well.correct me if i am wrong though.
  7. Replies
    7
    Views
    1,267

    sure, since you can use awk, here's an awk...

    sure, since you can use awk, here's an awk implemenation


    awk '{ printf $1" "$2" "$1" "
    for (i=3;i<=NF;i++){
    printf $i" "
    }
    print ""
    }' "file"
  8. Replies
    7
    Views
    1,267

    here's a vbscript for use in windows Set...

    here's a vbscript for use in windows


    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("c:\temp\yourfile", 1)
    Do Until objFile.AtEndOfStream
    ...
  9. Replies
    13
    Views
    1,621

    catting a file and piping to while loop is...

    catting a file and piping to while loop is unnecessary because the while loop itself can take in redirection. it can be shortened to


    while read line
    do
    ....
    done < $myvar

    or just
  10. Replies
    13
    Views
    1,621

    well, the way you ask the questions, it is 99.99%...

    well, the way you ask the questions, it is 99.99% homework to me..but nevertheless there's still 0.01% benefit of the doubt i can give to you.




    USER=$1 #first argument
    awk...
  11. you can head down to the official doc site...

    you can head down to the official doc site. there's a tutorial there by the creator himself, as well as the docs on its libraries and other stuff. that's all you need. Have fun
  12. I know Perl long before Python for doing sysadmin...

    I know Perl long before Python for doing sysadmin tasks and general programming, but after knowing Python, I converted all my scripts to Python and looked back. Now i have an easier time maintaining...
  13. Replies
    4
    Views
    3,110

    assuming printable characters you want: awk...

    assuming printable characters you want:


    awk '/[[:print:]]/{print}' file > newfile
  14. Thread: comparing

    by ghostdog74
    Replies
    7
    Views
    974

    just a small note: there is no need to do...

    just a small note:
    there is no need to do readlines() once a file handler is "initialized". This is sufficient


    testFile = open(sys.argv[1], 'r')
    for line in testFile:
    #do something
    ....
    ...
  15. OP is having problem doing that. so i just showed...

    OP is having problem doing that. so i just showed him another way that is commonly done.
  16. do it step by step: [/code] # grep "$1" log #...

    do it step by step:
    [/code]
    # grep "$1" log
    # if [ $? -eq 0] ; then
    echo "found"
    [/code]
  17. I don't understand why you said it did not work....

    I don't understand why you said it did not work. an example


    # more file
    This is first line
    This is second line
    This is the line with dollar sign and one : $1
    this is the final line
    Full...
  18. though i will not do your homework, the part...

    though i will not do your homework, the part where you are not getting results i can suggest to you. you can try this (double quotes) :
    grep "$1" logfile
  19. solaris doesn't have GNU date (from previous...

    solaris doesn't have GNU date (from previous post) or ls so you can't use those options. If you can't install any of these tools on your machine, AFAIK, the closest you can get is perl. in perl ...
  20. Replies
    13
    Views
    1,964

    if your top program has a -n option, you could...

    if your top program has a -n option, you could try :



    top -n 1


    it shows the result 1 time.
  21. Replies
    12
    Views
    8,892

    some performance lag, as time is spent removing...

    some performance lag, as time is spent removing spaces etc..


    pruneFile(){
    ......
    line="$line${part//[[:space:]]/}" #Remove all whitespace.
    ...
  22. Replies
    12
    Views
    8,892

    well, most linux boxes nowadays comes with...

    well, most linux boxes nowadays comes with python/perl installed too..
  23. Replies
    12
    Views
    8,892

    you can use regular expressions with...

    you can use regular expressions with perl/python.sorry , not particularly fond with sed.

    i added a few other words in your test file , just for testing.


    at 11 range testingtesting


    ...
  24. if you find that they don't provide this facility...

    if you find that they don't provide this facility , then use another tool.
    after all, there are plenty to choose from, esp in linux env :) . bottomline is, use the right tool for the problem to...
  25. please post your code...

    please post your code...
Results 1 to 25 of 32
Page 1 of 2 1 2