Find the answer to your Linux question:

Search:

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

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. I was able to work around it on a server that had...

    I was able to work around it on a server that had mounts to each of the HOST storage pools, but would still like to know how to do this should someone have any ideas.

    Here is my workaround ...
  2. Function in for loop, passing to ssh, heredoc involved

    I have the following script. The function, in and of itself, works correctly on the guest system when not passing it via ssh.


    #!/bin/bash

    CSV="/tmp/john.csv"

    HOST_NAMES="myhost1
    ...
  3. Found my own solution. Still needs some...

    Found my own solution. Still needs some additional testing, but seems to be working:



    #!/bin/bash
    file="/var/ftp/vm.cfg"
    total=$( grep ^vif "$file" | grep -o mac | wc -l )
    for i in `seq 1...
  4. sed -- reperforming operation for each instance found

    I need to change the vif (virtual interface) mac address within a file. I may have anywhere from 1 to 5 different mac addresses to change. I would like the last 2 octets to be randomized. I can do...
  5. Thread: regex and sed

    by jdh239
    Replies
    1
    Views
    1,681

    Got it.... needed sed -E, not sed -e

    Got it.... needed sed -E, not sed -e
  6. Thread: regex and sed

    by jdh239
    Replies
    1
    Views
    1,681

    regex and sed

    I haven't used regex with sed before. I have a syntax issue, but don't know how to correct it. Consider the following:
    https://regex101.com/r/EF2OLR/1

    If I have a variable that contains the...
  7. Replies
    2
    Views
    3,190

    If it is the same hardware and multiple OSs, I...

    If it is the same hardware and multiple OSs, I would check the hardware. You likely have something finicky or bad. If you can reproduce the issue regularly, I would start by swapping out some of...
  8. systemd startup failing -- custom python script

    I downloaded a python script allowing me to perform certain tasks. It requires a start/stop parameter to start or stop the service respectively. Unfortunately I have to run multiple instances of...
  9. From here: ...

    From here: https://unix.stackexchange.com/questions/100754/how-to-delete-a-specific-line-and-the-following-blank-line-using-gnu-sed



    sed '/^# file:/{N;/\n$/d}'


    Explanation:
    N is "append...
  10. I found this: ...

    I found this: https://stackoverflow.com/questions/31961990/delete-a-line-after-a-pattern-only-if-it-is-blank-using-sed-or-awk

    This is close. This deletes the blank line whenever the pattern is...
  11. regexp: Return all info between strings when pattern found

    I would like to parse a file I have and return all info between "^#\ file" and "^$" only when I find the pattern "r-x". I have been using regexp, but I am horrible at it. In addition, I don't know...
  12. This is UGLY, but seems to be working so far. ...

    This is UGLY, but seems to be working so far. Still open for suggestions:



    ps --no-headers axo user:1,pid:1,stat,pmem,rss,vsz,pcpu,cputime,lstart,etime,command | grep -v "no-headers" | tr -s...
  13. sed, delimit specific ranges of found instances

    I have the following command:


    ps --no-headers axo user:1,pid:1,stat,pmem,rss,vsz,pcpu,cputime,lstart,etime,command | grep -v "no-headers" | tr -s [:space:]


    Sample output:


    2000 25610...
  14. Solved

    Thanks all. I know there is probably a more succinct way to write this, but it is working. I didn't get it to work via getopts. Posting here for others to use should they choose.


    ...
  15. I know how bash works, however, I found your...

    I know how bash works, however, I found your response light on details. I am trying to clarify what you meant in your initial response.

    To me, it sounds like you are moving the binary out of...
  16. How do you mean? The xm command has valid...

    How do you mean? The xm command has valid functions, but it is "xm debug-keys -D" that I need to disable, leaving all other functionality in place.
  17. Prevent all users from executing a command (even root)

    We have a command that will bring down our servers depending on our patch level. We would like to alias this command to something harmless, or disable it all together. Removing it isn't an option....
  18. Replies
    2
    Views
    2,165

    I believe I figured it out. I was reading...

    I believe I figured it out. I was reading something somewhere that said unless the file exists it will not execute the prerotate (I am assuming firstaction, lastaction, and postrotate also). Once...
  19. Replies
    2
    Views
    2,165

    Anyone? I still haven't been able to get this to...

    Anyone? I still haven't been able to get this to work
  20. Replies
    2
    Views
    2,165

    logrotate "prerotate" not working

    I have a script that does some work for me. If I run it manually the script works fine. If I try to call it within logrotate it never works. I don't believe logrotate ever calls the script as it...
  21. Replies
    5
    Views
    1,445

    Awesome, thanks drl! I learned something new!

    Awesome, thanks drl! I learned something new!
  22. Replies
    5
    Views
    1,445

    This is a line from a file, and I read it into a...

    This is a line from a file, and I read it into a variable.

    Bash is the language I am scripting in (as it is the only one I know)
  23. Replies
    5
    Views
    1,445

    I have this, but wonder if there is a more...

    I have this, but wonder if there is a more elegant way to accomplish this:



    echo $TEST | sed 's/file\:/\nfile:/g' | grep ^file | cut -d / -f 2-6 | cut -d , -f 1
  24. Replies
    5
    Views
    1,445

    bash: Parse variable

    I have a variable with the following content (could vary from 1 to many .img files):



    disk =...
  25. Replies
    7
    Views
    1,427

    Further explanation: declare -ir...

    Further explanation:


    declare -ir bitspeed=$(( `ethtool \`route | grep ^default | awk '{print $NF}'\` | grep -i speed | awk '{print $NF}' | grep -o '[[:digit:]]*'` * 1000 ));


    declare -ir...
Results 1 to 25 of 94
Page 1 of 4 1 2 3 4