Skip to content

Instantly share code, notes, and snippets.

@huyanhvn
huyanhvn / Shell string tricks
Last active January 26, 2017 15:18
shell string tricks
### REPLACE \n WITH LITERAL '\n'
sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g'
### SEARCH AND PRINT REGEX MATCH
echo ... | sed -n -e "s/^.*arn:aws:iam::\(.*\):user.*/\1/p"
### PRINT SEQUENCE
seq -f "10.235.5.%g" 117 126
### SEARCH AND REPLACE IN FILES