Quantcast
Channel: User ozzy - Unix & Linux Stack Exchange
Browsing all 31 articles
Browse latest View live

Answer by ozzy for Write shell script to analysis log file

In an unpolished version, a Bash-script could look like this, assuming that your data is contained in datafile: #!/bin/bash printf "IPs where status is fail:\n" grep -z -oP 'IP=\K.*\n(?=STATUS=FAIL)'...

View Article



Answer by ozzy for Exit shell script containing indefinitely running java...

The question is a bit puzzling to me, not in the least because of the pipe (to tee) that you apparently wish to use. To maintain this functionality, you could use the following script: #!/bin/ksh tee...

View Article

Answer by ozzy for Usage of nc with timeouts in ms

I don't think it is possible with nc alone. But you can additionally use the timeout tool (GNU coreutils package) which allows you to run a command with a timelimit specified as a floating point...

View Article

Answer by ozzy for wget image problem for daily wallpaper script

Your script needs a bit of a makeover. The two lines following the #Set image url, name and location line are broken for various reasons (e.g. incorrect grep syntax, incorrect assignment). In addition,...

View Article

Answer by ozzy for How to grep a line who has execution time greater than X

Assuming that the lines continue after "Lambda", as suggested by the OP, this command should work: gawk 'match($0, /execution\stime:([0-9]+)s/, a) && a[1] > 10 { print $0 }' logfile with...

View Article


Answer by ozzy for Can't run parallel zgrep with regex

If you are using the parallel command from the moreutils package, your command could be simplified like this: parallel zgrep -e "\(text1\|text2\).*Exception" -- my.log*.gz This will run parallel...

View Article

Answer by ozzy for How to make symlink executable?

Bash will find an executable specified by its bare filename (i.e. without preceding path elements) only if it is on its search path, which is stored in the PATH variable. The current directory is not...

View Article

Answer by ozzy for Find and copy with exec not working

Your command appears to have two issues, the first of which may not matter much in your case, but is nevertheless worth pointing out: (i) it is not generic in the sense that it will not be able to...

View Article


Answer by ozzy for command line tool to download complete podcast from rss feed

I'm not really familiar with rss feeds or the format that they come in. Neither do I see, using newsbeuter for instance, the close to 200 episodes that you say are present in the feed (I see only 10...

View Article


Answer by ozzy for How to sort a file with multiple delimiters?

You could use this: awk 'NR<=4 {print $0; next } { print $0 | "sort -k6,6 -t\\|" }' listing.txt It runs awk on listing.txt; instead you could pipe the data into awk (leaving out the listing.txt at...

View Article

Answer by ozzy for Replace lines in multiple files matching a pattern with...

With GNU awk (i.e. gawk) you could do: gawk -i inplace '/mock/ { getline < "mock.txt" } 1' test{1..3}.txt Like sed, gawk offers inplace editing. The above command looks for the regex-pattern mock,...

View Article
Browsing all 31 articles
Browse latest View live


Latest Images