2,854 reputation
11418
bio website icyrock.com
location
age
visits member for 3 years, 10 months
seen Jul 17 at 2:54

More here: icyrock.com


Aug
11
comment merge groups of lines with sed
@katosheen Misunderstood what you meant - see my edit and obviously take a look at other answers, too. I think perl or awk solutions are more readable here, in case you don't need to use sed exclusively.
Sep
20
comment What is 127.0.0.2 IP address for?
@SilverSkin Would you mind explaining what you mean? The only difference between what's in answer and what's in Wikipedia now is that they (correctly) excluded 127.0.0.0 and 127.255.255.255, which are network / broadcast addresses. The gist is still the same - 127.x.x.x == 127.0.0.1 (except for 127.0.0.0 and 127.255.255.255, which is expected on any /8 network).
Apr
15
comment Pop current directory until specific file is found
@zpea Well, the requirement as "The script would end once we find the file or we reach the root." - so, it's up to the specs ;) Useful comment, though, thanks!
Apr
8
comment How to use verbatim strings in sed?
The command in the provided links gives you that (the one you put in your first comment to my answer). The problem is that you cannot do that the way you want - the input from echo command cannot even get to the sed to be escaped, it has to be escaped in-place to be even printed by echo correctly. The other solution - putting the string into the file - is what would work, see my edit. Hope that will work for you.
Apr
7
comment How to use verbatim strings in sed?
If you mix both ' (single quote) and " (double quote), you will have to escape something in the string. This is not a "problem" with sed per-se, even if you do just echo "a\c:ti]\']x""/\//:~$%#^&"', it will be not a complete string. E.g. you cannot do echo "abc"" and expect it to print abc"` - you have to escape the ".
Mar
16
comment I cannot install Xubuntu from local ISO image through wubi
Nice, thanks for the info @iglvzx!
Mar
10
comment Downloading with wget while not knowing the end index
@Idigas You can install Cygwin. It has a bash shell and wget, so you should be able to run the above without a problem.
Mar
9
comment Why does 'killall killall' not work?
I get the (extremely corner-case) brain-teasing side of the exercise but - why would you ever want to do this? :)
Mar
2
comment Loop bash command until output no longer contains a string
Take a look at this: pastie.org/3507958
Mar
2
comment Loop bash command until output no longer contains a string
If you type in plain command prompt expr index abc b and get an error, then it's not supported (I'm using bash 4.2.10, so it's a lot newer version). In that case, try this if [ `$str|grep 'NOT successful'` ]; then. If that doesn't work, then it's time for a bash upgrade :)
Mar
2
comment Loop bash command until output no longer contains a string
Try this: if [[ `expr index "$str" 'NOT successful'` -eq 0 ]]; then
Mar
2
comment Loop bash command until output no longer contains a string
Sure thing, glad to help!
Mar
2
comment Loop bash command until output no longer contains a string
Sure - just use if [[ ! $str =~ 5 ]]; then instead, see my edit.
Feb
25
comment shell scripting grepping for pattern and then echo message
@grawity Thanks, that's a nice tip - edited for others who might stumble upon.
Feb
18
comment replace all names with an alternative using Stream editor (Sed)
Sure thing, glad it worked!
Jan
30
comment Chrome running as service on XP
Given what the link says, it seems this depends on the way you installed Chrome. Did you install it for all users or not? If not, then (see my answer for the relevant quote) it is expected that you don't end up with a service running.
Jun
30
comment How do I upgrade Emacs to the current version on Ubuntu
Just a correction - you'd do git pull to update to the newest version.
Dec
21
comment Why “ln -s A B” is different from “ln -s A/ B”?
@Martijn Thanks a lot - I misread that part... Edited for the future.
Dec
19
comment Windows cannot find the host name “download.microsoft.com” using DNS
@joedotnot Ah, classic... Glad you solved your poblem!
Dec
14
comment Count the number of words in a PDF file
@frabjous Thanks, updated the answer with the suggestions!