Changes

From Amahi Wiki
Jump to: navigation, search
===Miscellaneous===
* Suppress Console Output:
command &> /dev/null
* Remove blank lines from file:
sed -i '/^$/d' filename
* Delete lines in file:
sed '/pattern/d' file
* Add lines before pattern:
<pre>sed -i '/pattern/i \
line1 \
line2' file</pre>
* Add lines after pattern:
<pre>sed -i '/pattern/a \
line1 \
line2​' file</pre>
* Insert line based on text1 (Previous Line):
sed -i '/text1/ i\text2' /filename;
* Insert text at line number 3:
sed '2 aappended line' filename;
* Replace text with variable:
sed -i 's/text/'$VARIABLE'/' filename;
* Patch Comment:
# FIXME - this needs to be hosted in dl.amahi.org prior to going live!
* AmahiSync Web Link:
<nowiki>http://username.amahi.me/Public/filename</nowiki>
* Patch Diff:
<pre>diff -r -N -b -u html.orig html > app-patch.diff</pre>
patch -s -p0 -E << 'EOF'
'EOF'
<pre>patch -p0 -E < app-patch.diff</pre>
* Cat EOF:
:with variables
cat > test << EOF
... text goes here ...
'EOF'
* Run as First Admin User:
<pre>su $FUSER -c command</pre>
* Redirect to specific URL (change ''url='' to desired path (i.e. <nowiki>http://appname/appdirectory</nowiki>):
<pre>echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
12,424

edits