Skip to content

Commit 560a55a

Browse files
authored
Update 'sed'.md
1 parent 8fc72dd commit 560a55a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

'sed'.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ a\
9797
`-n -e '/.../{x;p;d;}' -e x` : print 1 line above matched
9898
`$(( $( sed -n '/.../=' $file ) - <n> ))' <x>'` : \<n\> line prior to matched
9999

100-
`sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba'` : remove all trailing new lines
101-
`sed -i -e '$a\'` : add a trailing new line if not exist
100+
`sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba'` : remove all trailing new lines
101+
or `printf '%s\n' "$( cat file )"`
102+
`sed -i -e '$a\'` : add a trailing new line if not exist
102103

103104
**string operations**
104105
alternative: [simple brace expansion](https://github.com/rern/bash_tips/blob/master/string_extract_edit.md)

0 commit comments

Comments
 (0)