Find the answer to your Linux question:

Search:

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

Page 1 of 19 1 2 3 4

Search: Search took 0.02 seconds.

  1. Replies
    1
    Views
    621

    awk '/Item2/ && /online/' file this will print...

    awk '/Item2/ && /online/' file

    this will print any line with "Item2" and "online" .
  2. Replies
    4
    Views
    717

    if you are using some kind of modern shell, eg...

    if you are using some kind of modern shell, eg bash, ksh etc, they already have internal capabilities to string manipulation


    $ text="foo,fee,fii,fuu"
    $ IFS=","
    $ set -- $text
    $ echo $1
    foo...
  3. Replies
    12
    Views
    2,080

    with bash, you can cut down the use of external...

    with bash, you can cut down the use of external tools. Also, use shell expansion for globbing files...


    destDir="/tmp"
    for i in *ODS.POS*
    do
    OIFS="$IFS"
    IFS="."
    set -- $i
    code=$3
  4. Replies
    12
    Views
    2,080

    with Python, if file is reasonably not huge ...

    with Python, if file is reasonably not huge



    thelength=len(open("file").readlines())
  5. Replies
    3
    Views
    775

    put on top sed '1 i text' file put at...

    put on top


    sed '1 i text' file

    put at line number 10


    sed '10 i text' file
  6. Replies
    12
    Views
    2,080

    Gosh, if you are using Python, then do everything...

    Gosh, if you are using Python, then do everything in Python. There's no need to call system() commands.!!
  7. Replies
    12
    Views
    2,080

    awk -F"." 'NF{print $0 > $3".dat}' file

    awk -F"." 'NF{print $0 > $3".dat}' file
  8. Replies
    2
    Views
    2,095

    do everything in Perl if you are using Perl. ...

    do everything in Perl if you are using Perl.



    open( F,"<" ,"file") or die "Cannot read file:$!\n";
    while(my $line = <F>){
    # see perldoc -f tr
    }
  9. Thread: file rename

    by ghostdog74
    Replies
    8
    Views
    9,069

    for file in zzzzfpa.* do echo mv "$file"...

    for file in zzzzfpa.*
    do
    echo mv "$file" "${file#zzzz}"
    done
  10. Replies
    4
    Views
    40,707

    ip="192.168.0.1" IFS="." set -- $ip echo...

    ip="192.168.0.1"
    IFS="."
    set -- $ip
    echo "$1,$2,$3,$4"
  11. Replies
    3
    Views
    1,042

    awk ' {m=gsub(/xyz/,"") ;t+=m} END{print t}' file

    awk ' {m=gsub(/xyz/,"") ;t+=m} END{print t}' file
  12. Replies
    3
    Views
    816

    $ string="A.C" $ IFS="." $ set -- $string $...

    $ string="A.C"
    $ IFS="."
    $ set -- $string
    $ echo "$1.B.$2.D"
    A.B.C.D
  13. Replies
    2
    Views
    2,344

    do your own homework first. what have you tried

    do your own homework first. what have you tried
  14. Replies
    6
    Views
    1,033

    use the find command. check the man page for more...

    use the find command. check the man page for more


    find /home/ -type d -exec cp "/root/index.html" "{}" \;
  15. it doesn't matter. what i am trying to tell you...

    it doesn't matter. what i am trying to tell you is, there's no need to invoke a while loop on top of that, a useless cat and awk together.
  16. then its just this awk '{print $1}' ZINC* >>...

    then its just this


    awk '{print $1}' ZINC* >> combined_file.txt
  17. this is sloppy. What's with all the backticks ,...

    this is sloppy. What's with all the backticks , and the useless cat?? don't even need while loop when you use awk


    awk '{print $1}' summary.txt >> combined_file.txt
  18. you can do this with the shell for file in...

    you can do this with the shell


    for file in ZINC*
    do
    while read -r a b c d e
    do
    case "$a $b $c $d $e" in
    *Score* ) echo "$c $d" >> summary.txt
    esac
  19. Replies
    2
    Views
    738

    if you want to use [ to test for integers, quote...

    if you want to use [ to test for integers, quote your variables


    if [ "$#" -gt 2 ];then
    .....
    fi
  20. Replies
    25
    Views
    2,315

    then i recommend you look at the source code of...

    then i recommend you look at the source code of these tools, eg grep or awk. Inside the source, you can take reference on how people parse strings in C
  21. Replies
    25
    Views
    2,315

    homework? if not, why reinvent the wheel. you can...

    homework? if not, why reinvent the wheel. you can use already recognized tools such as awk, grep etc to parse your logs.
  22. Replies
    8
    Views
    1,027

    Forget about C first. Learn how to program in...

    Forget about C first. Learn how to program in Python. After you become proficient in it, you can start to learn other languages, C included.
  23. var1=1000 while IFS="-" read col1 col2 col3 col4...

    var1=1000
    while IFS="-" read col1 col2 col3 col4 col5 col6
    do
    col6=${col6//[^0-9]/}
    case "$col6" in
    [0-9][0-9][0-9])echo "$col1 $col2 $col3 $col4 $col5 $col6" ;;
    esac
    #...
  24. Replies
    3
    Views
    823

    you can do it with the shell $ file="Top...

    you can do it with the shell


    $ file="Top Gear 14x01 - blah"
    $ set -- $file
    $ echo $3
    14x01
    $ t=$3
    $ IFS="x"
    $ set -- $t
  25. change IFS to cater for files with spaces when...

    change IFS to cater for files with spaces when using for loop and cat like that, otherwise, just use while read loop


    while read -r line
    do
    rm -i "$line"
    done < "file"
Results 1 to 25 of 460
Page 1 of 19 1 2 3 4