.bash_profile sed: \1 not defined in the RE

You should use \(.*\) instead of (.*). sed uses Basic Regular Expressions (BRE) by default, which uses \( and \) for group capturing, not just ( and ) as used in Extended Regular Expressions (ERE). Since your expression used (.*) instead of \(.*\), it is not recognised as a group capture, and thus nothing is … Read more

Have sed ignore non-matching lines

If you don’t want to print lines that don’t match, you can use the combination of -n option which tells sed not to print p flag which tells sed to print what is matched This gives: sed -n ‘s/…/…/p’

How to escape single quote in sed?

Quote sed codes with double quotes: $ sed “s/ones/one’s/”<<<“ones thing” one’s thing I don’t like escaping codes with hundreds of backslashes – hurts my eyes. Usually I do in this way: $ sed ‘s/ones/one\x27s/'<<<“ones thing” one’s thing

Add text at the end of each line

You could try using something like: sed -n ‘s/$/:80/’ ips.txt > new-ips.txt Provided that your file format is just as you have described in your question. The s/// substitution command matches (finds) the end of each line in your file (using the $ character) and then appends (replaces) the :80 to the end of each … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)