11,464 reputation
2654
bio website
location
age
visits member for 2 years, 7 months
seen 1 hour ago

Jul
21
comment sed regex issue
Do not redirect file to itself. In the end you may stay with an empty file. Use sed -i (only for gnu sed) instead or separate temporary file. Also you can use \s instead of [[:space:]] as it also includes \t and all other whitespaces.
Jul
17
comment Excessively high disk usage freezes my server
Logs? Did you check logs? like /var/log/messages or /var/log/dmesg.0 and so on?
Jul
3
comment force ssh to change dir after login based on config
Nope, unfortunately ports usually are the same for different projects on one machine. Ports may differ only between machines.
May
28
comment Queue a task in a running shell
Nope, unfortunately it doesn't scale to multiple tasks. In construction sleep 100 ; echo test echo will be executed immediately after ctrl+z.
May
7
comment How can I use Unix to rename all html files by their titles?
@InquilineKea I modified the loop to also check if file already exists and if yes it will try to add existing filename to the title. Also a bit more detailed sed explanation is added.
May
7
comment How can I use Unix to rename all html files by their titles?
@InquilineKea in case with multiple titles the first one will be used. In case with the same titles currently it files will be overwritten.
May
5
comment What is the best way to create remote tunnel?
Yep, -L means you're binding local port, so you have to open 10.0.0.10:80 instead of 50.50.50.50:80 . If you want to open 50.50.50.50:80 use -R. Also there is -C option in ssh which can compress and save your traffic a little bit.
May
5
comment What is the best way to create remote tunnel?
Keep in mind, that in case with port forwarding all your traffic between servers is plain and easily accessible for third party, while in case with ssh tunnel it is encrypted. May be this is important for you.
Apr
24
comment Split files and rename the files
@user1050619 that also is not it problem, though it wasn't specified from the beginning: use this way: split -n 5 -d -a 1 --additional-suffix=test Test ""
Mar
28
comment bash find lines starting with string
@Jérémie $q1 -- forces sed to quit with an error if pattern is not found. It also will finish with error if something is wrong with file (it's unreadable or broken). So it will quit with 0 exit status only in case pattern is found and it will be passed to print. Part with /^C/{n;/^C/q is pretty simple. If it find string that starts with C it will read the next line and if it also starts with C it will quit with zero exit status.
Mar
9
comment Use basename to parse a list of paths held in a file
Actually the best source would be man find in your console :)
Mar
9
comment Use basename to parse a list of paths held in a file
That's strange. I can see -printf even in posix man page. About the error with second way, it's cause of typo in my answer. Fixed. Could you please try it one more time?
Feb
6
comment Do I need to encapsulate awk variables in quotes in order to sanitize them?
Nope, if you'll take SOURCEIP in quotes inside awk, it won't be processed as variable.
Nov
29
comment difference between `for i in {1..$N}` and `for i in $(seq 1 1 $N) `
You can use eval echo ${1..$N}. That will expand it like expected. But be careful with eval, as eval is evil and if it's possible to avoid its use, it's better to do it.
Nov
21
comment mail: send email with attachment from commandline
@glennjackman yes, that's right. thanks for your note.
Nov
19
comment Using variable in KSH function
Could you show the exact code you're runnning? And did you try to execute it in verbose mode ( set -x )?
Nov
15
comment What does this regex mean?
@JoeDimaggio actually in sed \n is outside working pattern ( except cases when several lines are in the buffer, but even in that case the last \n will be outside the buffer ) and \r will appear just before \n.
Nov
15
comment What does this regex mean?
@JoeDimaggio You can use it directly. Initially ` symbol was hidden in your question. I updated my answer.
Nov
15
comment Remove all *.mp4 and *.zip but some files
@DrakaSAN you can use something like find . -name *.ext ! -name 1.ext
Oct
17
comment How to see interactive output when running commands from a bash script?
Try to specify -i option in she-bang. It may help you.