:1,$d # starting at line 1, until the end of the line, delete.
# Strip HTML tags
sed -e 's/<[^>]*>//g'
# grep with or without "tab character"
|grep -P "\t"
# sed, why
s/\(<td>\).*\(<\/td>\)/<td>TEXT_TO_REPLACE_BY<\/td>/g
# Unless boom is found replace aaa with bb# sed remove html tags
'/boom/!s/aaa/bb/' file.txt
curl www.gnu.org | sed 's/<\/*[^>]*>//g'
# something...
cat > /tmp/h/a <<EOF
cassandra soft nofile 100000
cassandra hard nofile 100000
cassandra soft nproc 32768
cassandra hard nproc 32768
cassandra soft stack 10240
cassandra hard stack 32768
cassandra hard memlock unlimited
cassandra soft memlock unlimited
EOF
cat /tmp/h/a
cassandra soft nofile 100000
cassandra hard nofile 100000
.
.
.
# replace STRING1 to STRING2 if line contain STRING3
for i in $(cat STRING_LIST) ; do sed -i "/${i}/s/STRING1 /STRING2 /" FILE_U_WANT_TO_MODIFY ; done
for i in $(cat ip) ; do sed -i "/${i}/s/host /#host /" 184.conf ; done
# cat ip
10.1.112.34
10.1.112.35
10.1.120.210
sed '/STRINGS/d' FILE.TXT
while read p; do sed "/${p}/s/host /#host /g" FILE1.TXT; done < STRING.TXT |grep IPADDRESS
sort by 3rd field, separator=":"
sort -k3 -t:
sed 's/[()]//g': remove "()"
cat /etc/passwd|sed 's/qemu/& and kvm/'
sed '5!d' FILE
awk 'NR==5' FILE
sed remove line if pattern matched
sed -i '/pattern/d' file
# vim delete all line
:0,$d
# sed replacing string
grep -R gpgcheck /etc/yum.repos.d/* |awk -F: '{print $1}' |xargs sed -i 's/gpgcheck\=1/gpgcheck\=0/g'
-d, --dictionary-order consider only blanks and alphanumeric characters
-f, --ignore-case fold lower case to upper case characters
-g, --general-numeric-sort compare according to general numerical value
-i, --ignore-nonprinting consider only printable characters
-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'
-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)
-n, --numeric-sort compare according to string numerical value
-R, --random-sort sort by random hash of keys
--random-source=FILE get random bytes from FILE
-r, --reverse reverse the result of comparisons
--sort=WORD sort according to WORD:
-V, --version-sort natural sort of (version) numbers within text
-u, --unique with -c, check for strict ordering;
ls
-c: sort by ctime
-r: reverse
-t: sort by mtime
-u:sort by access time?
-X: sort by alphabetically
No comments:
Post a Comment