Search:

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

Page 1 of 10 1 2 3 4

Search: Search took 0.21 seconds.

  1. [SOLVED] Re: sed - make substitution occur only after a specified string

    Hi,


    $ x="MARK 1 text<br> text <br> text MARK 2<br> text<br> text <br> text.<br>"
    $ echo "$x" | sed -r ':a;s/^(.*MARK 2.*)<br>/\1/;ta'
    MARK 1 text<br> text <br> text MARK 2 text text text....
  2. Thread: sed help

    by DaithiF
    Replies
    2
    Views
    364

    [SOLVED] Re: sed help

    any of these:

    sed 's/ \+/,/g'
    sed -r 's/ +/,/g'
    sed 's/[[:space:]]\+/,/g'
    sed -r 's/[[:space:]]+/,/g'
  3. Replies
    3
    Views
    385

    [SOLVED] Re: backslash in sed

    Hi,
    I would suggest you always put qotes around your sed expressions unless they are trivially simple, otherwise you risk the shell's processing of your line interfering with what you want to pass...
  4. Thread: SED Help

    by DaithiF
    Replies
    5
    Views
    351

    Re: SED Help

    another variation:

    $ sed -n '/^\s*$/d;/^\s*--/d;1h;1!H;${x;s/\n/ /g;p}' test
    this is line1 next line2 line3 then line5 last ;

    @tdyboc, the reason you had trouble doing this in one sed...
  5. Replies
    1
    Views
    477

    [all variants] Re: umountfs sed explanation

    Hi,
    your understanding of the pattern is correct.


    0,/pattern/p

    says to print lines from the start of the file up to the first line that matches the pattern.

    in short, its printing the...
  6. Replies
    12
    Views
    884

    [SOLVED] Re: Bash Scripting - How do I search a file?

    i've just noticed sisco's new profile pic, and now yours too nothingspecial, hmm, did i miss out on a recent cat-in-clothes meme? :)
  7. Replies
    12
    Views
    884

    [SOLVED] Re: Bash Scripting - How do I search a file?

    @lisati, you must be my long lost cousin from NZ :)
  8. Re: how to check a directory's permissions in a bash script???

    check out stat

    e.g.
    stat /some/path
    To pick out the permissions, something like:

    perms==$(stat /some/path | sed -n '/^Access: (/{s/Access: (\([0-9]\+\).*$/\1/;p}')
    if [[ $perms =~ 777 ]];...
  9. Thread: Cron job help!

    by DaithiF
    Replies
    8
    Views
    532

    [SOLVED] Re: Cron job help!

    Don't do that. Create 1 script that checks if a user is logged in, and use that script in your cron entry.

    e.g.
    create a script called loggedin

    #!/bin/bash
    who | grep -q $1


    then your...
  10. Thread: grep question

    by DaithiF
    Replies
    5
    Views
    317

    [ubuntu] Re: grep question

    when you grep for multiple patterns at a time grep reads each line once and checks all the patterns against that line before moving on to the next line. So you can't get the behaviour you want using...
  11. Replies
    7
    Views
    2,545

    [SOLVED] Re: Cron isn't working

    Hi,
    an individual users crontab (including root's) does not have a user field, unlike the system-level crontabs. So take out 'root' from each of your cron lines and try again.
  12. Replies
    5
    Views
    369

    [SOLVED] Re: quick cron question

    Yes, cron runs jobs for users regardless of whether or not they are logged in. Thats one of the key features of cron actually ... the ability to run jobs unattended. As long as the PC is on, and...
  13. Replies
    4
    Views
    595

    [other] Re: Edit a config using bash....

    I'd never thought about it before, but what a strange idiom that is ... what are these several ways, and why do we need to skin cats anyway? :)
  14. Replies
    2
    Views
    431

    [ubuntu] Re: Problem with cron

    Hi, capture the output of the job to a file so that you can see what errors are reported. there are a variety of reasons why jobs may fail under cron, so rather than guess which particular ones are...
  15. Replies
    4
    Views
    595

    [other] Re: Edit a config using bash....

    Hi, so you just want to uncomment those lines then, rather than make other changes to them?

    if so, tell sed to do something on a range of lines, starting when it matches the # enable bash...etc...
  16. Replies
    5
    Views
    3,741

    [SOLVED] Re: cron.daily hanging my system?

    ok good. Certainly mlocate would be a likely candidate -- as it updates its index of all local filesystems.
  17. Replies
    5
    Views
    3,741

    [SOLVED] Re: cron.daily hanging my system?

    Ok, nothing strange there. We can definitely discount the php5 job as an issue since in fact its not even being run by cron.daily, instead its an entry in /etc/cron.d, and it gets run twice an hour...
  18. Replies
    2
    Views
    336

    [all variants] Re: Need help with awk filtering

    grep -or "your phrase" .
    seems like a good start, like Vaphell says, unless the phrase varies line by line and you therefore need to match on a subset of the phrase.
  19. Replies
    5
    Views
    3,741

    [SOLVED] Re: cron.daily hanging my system?

    Hi,
    the last command in the log before the hang is pretty innocuous:


    [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin ...
  20. Replies
    22
    Views
    1,818

    [SOLVED] Re: shell-script count to variable

    ah yes, you're running ls within a subshell so the fact that you are setting shopt -s nullglob in the parent has no effect unfortunately.

    so plan B :) , throw away the ls error output:

    i=$(ls...
  21. Replies
    22
    Views
    1,818

    [SOLVED] Re: shell-script count to variable

    interesting. I think I understand now. you're running fish as your interactive shell. It has a builtin count command, the only shell I know that does.

    your script however has a shebang of...
  22. Replies
    22
    Views
    1,818

    [SOLVED] Re: shell-script count to variable

    its not telling you that its not finding avi files, its telling you that it can't find the 'count' command :)

    I've never heard of a count command like this either actually. you say it works from...
  23. Replies
    22
    Views
    1,818

    [SOLVED] Re: shell-script count to variable

    as gmargo says, $( ...) or ` ... ` for running commands and capturing their output. $' ... ' is a different construct in bash.
    from man bash:

    Words of the form $'string' are treated...
  24. Replies
    3
    Views
    2,603

    [SOLVED] Re: Cron not running rsync?

    Hi,
    capture stdout & stderr output from the job to a log file and inspect it afterwards for errors.
    ie. amend you cron definition like so:
    * * * * * /path/to/yourjob >> /path/to/logfile 2>&1
  25. Thread: grep help

    by DaithiF
    Replies
    11
    Views
    636

    [SOLVED] Re: grep help

    yes, ls *{word1,word2}* would expand to:
    ls *word1* *word2*
    which will give equivalent results in this case (and without needing extglob set)

    there are other extglob patterns that you wouldn't...
Results 1 to 25 of 250
Page 1 of 10 1 2 3 4