Find the answer to your Linux question:

Search:

Type: Posts; User: watael; Keyword(s):

Page 1 of 14 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    3,338

    based on Irithori 's answer, using sed: $...

    based on Irithori 's answer, using sed:
    $ foo='Network "123" "ABC"'
    $ sed 's/\([^ ]*\) \([^ ]*\) \(.*\)/\1 \2\n\1 \3/' <<<"$foo"
    Network "123"
    Network "ABC"bash's way:
    read one two three...
  2. Replies
    58
    Views
    5,474

    sometimes you should not worry more than the OP;...

    sometimes you should not worry more than the OP; simply warn.
    no need for flaming.

    you're both idiot. ;)
  3. Replies
    9
    Views
    1,720

    [SOLVED] glad to hear you got it working. however cat...

    glad to hear you got it working.
    however
    cat <<'eof' >/tmp/gmail.conf
    # Adding config for gmail #
    define(`SMART_HOST', `[smtp.gmail.com]')dnl
    define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl...
  4. hi, #!/bin/bash shopt -s extglob printf...

    hi,


    #!/bin/bash

    shopt -s extglob
    printf '%s\n' /dev/sd!(a|b)
  5. Replies
    9
    Views
    1,720

    [SOLVED] I say it again : put your config data into a...

    I say it again : put your config data into a file, and use sed's r command !!!!!
    RTFM!
  6. Replies
    9
    Views
    1,720

    [SOLVED] are you kidding ? you copy/paste the same post...

    are you kidding ? you copy/paste the same post without improvement !

    first, if you don't do what I tell you (use an external file and use r command) you won't reach your goal.
    next, when you talk...
  7. Replies
    4
    Views
    1,240

    nothing to do with sed. open a new thread and...

    nothing to do with sed.
    open a new thread and paste the script.
  8. Replies
    4
    Views
    1,240

    hi, put data to be added inside a file and use...

    hi,

    put data to be added inside a file and use sed's r command, instead of a.
  9. Replies
    5
    Views
    1,363

    at a moment or another hashes will be parsed one...

    at a moment or another hashes will be parsed one by one...

    you could fill a file with them and grep each file's md5sum, and if it matches, then output filename.
  10. Replies
    5
    Views
    1,363

    hi, what do you think a cron job would be...

    hi,

    what do you think a cron job would be useful for ?


    find / -type f -exec md5sum {} \; | grep "$md5Val"

    be clear on the steps that are needed to reach your goal.
  11. Replies
    2
    Views
    1,100

    Hi, first, don't use a for loop to read a file...

    Hi,

    first, don't use a for loop to read a file :
    while IFS='/' read -a ar; do echo "${ar[@]: -1}"; done < idlist.txt

    next, grep -v and the appropriate regex should do the job.
  12. Replies
    3
    Views
    1,555

    hi, XML files are so unpredictable, they have...

    hi,

    XML files are so unpredictable, they have to be treated with xml tools : xmlstarlet, xsltproc...
  13. Replies
    3
    Views
    1,184

    hi, fileType=$(file --brief --mime-encoding...

    hi,

    fileType=$(file --brief --mime-encoding "$userFile")
  14. Replies
    2
    Views
    1,100

    hi, that's basics. stfw...

    hi,

    that's basics. stfw.

    plus, cat is a useless tool to parse file.
  15. at least hebruiser shows coding attempts. and is...

    at least hebruiser shows coding attempts.
    and is polite.
  16. hello again ;) a while read loop is the safest...

    hello again ;)

    a while read loop is the safest way to read a file with shell:

    #!/bin/bash

    fileDir='/absolutePath/toFilesDir'
    file="$fileDir/vms.txt"

    test -f "$file" || { >2 echo "$0:...
  17. [SOLVED] hi, #!/bin/bash while true do echo...

    hi,

    #!/bin/bash

    while true
    do
    echo "blah... : "
    read choice
    #...
    test "$choice" = "n" && break
  18. Replies
    7
    Views
    1,399

    echo "My ifconfig info is: " >> /Volumes/USB/MAC\...

    echo "My ifconfig info is: " >> /Volumes/USB/MAC\ Test/interface.txt
  19. Replies
    2
    Views
    734

    hi, first, test -g does not what you seem to...

    hi,

    first, test -g does not what you seem to think, it tests a file.
    check help test.
    arguments in tests have to be quoted. every variables have to be quoted. always.

    don't you get an error...
  20. Replies
    6
    Views
    1,020

    quote $1 and $2 : grep 'ERROR' "$1" perhaps...

    quote $1 and $2 :
    grep 'ERROR' "$1"
    perhaps it's not the loop that doesn't end, but grep who's waiting for input.

    as you can't show much, we tell much either.
  21. Replies
    6
    Views
    1,020

    nothing obvious in this snippet should lead to...

    nothing obvious in this snippet should lead to endless looping ;)

    the code downloads 4 times (from 0 to 3 both included) three files (addresses are a bit weird though) given as arguments to the...
  22. Replies
    6
    Views
    1,020

    hi, how will it download 'one instance' as...

    hi,

    how will it download 'one instance' as downloads are done 6 times ?

    place a set -x at the start of the script (under the shebang), execute the script, and show the output, please.
  23. read it line by line into four variables, the...

    read it line by line into four variables, the simple way.
  24. @nihili this won't work, as array's items will...

    @nihili
    this won't work, as array's items will be filled with what can be considered as fields, and not with lines.

    ${x[0]} will be first line name, ${x[1]} will be first line term's name,...
  25. when you want code to be seen, don't post images,...

    when you want code to be seen, don't post images, post copy/paste code.
Results 1 to 25 of 338
Page 1 of 14 1 2 3 4