linux:bashscriptexamples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:bashscriptexamples [2015/07/26 12:24] – [Find files that contain the text with for] admin | linux:bashscriptexamples [2015/11/12 14:03] (current) – removed admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Bash Script Examples ====== | ||
- | ===== Actual scripts to process text ===== | ||
- | ==== Find files that contain the text with for ==== | ||
- | <code bash> | ||
- | grep -rnw babyshopvn -e "Begin Facebook Code" | ||
- | </ | ||
- | ==== readline with while ==== | ||
- | === example1 === | ||
- | <code bash> | ||
- | while read line; do username=`echo $line | awk ' | ||
- | </ | ||
- | === example2 === | ||
- | <code bash> | ||
- | #!/bin/bash | ||
- | if [ " | ||
- | date=`date +%Y_%m_%d` | ||
- | else | ||
- | date=$1 | ||
- | fi | ||
- | echo $date | ||
- | while read line; do username=`echo $line | awk ' | ||
- | </ | ||
- | === example3 === | ||
- | <code bash> | ||
- | while read line; do trans_id=`echo $line | awk -F',' | ||
- | </ | ||
- | ==== check file exists ==== | ||
- | <code bash>if [ -f ./ | ||
- | <code bash>for i in `cat listgames.txt `; do filename=`find . -name " | ||
- | <code bash>for i in `cat listgames.txt `; do filename=`find . -name " | ||
- | ==== change text ==== | ||
- | === example1 === | ||
- | <code bash> | ||
- | </ | ||
- | === example2 === | ||
- | <code bash> | ||
- | </ | ||
- | ==== get text in flash ==== | ||
- | Create svn.txt | ||
- | < | ||
- | *.svn | ||
- | *.settings | ||
- | *.project | ||
- | *.buildpath | ||
- | *.swf | ||
- | *.fla | ||
- | *.as | ||
- | *.xml | ||
- | *.jpg | ||
- | *.png | ||
- | *.PNG | ||
- | *.psd | ||
- | *.db | ||
- | *.bak | ||
- | *.mp3 | ||
- | </ | ||
- | * string:< | ||
- | for i in `find . -name ' | ||
- | for i in `find . -name ' | ||
- | </ | ||
- | * int:< | ||
- | for i in `find . -name ' | ||
- | for i in `find . -name ' | ||
- | </ | ||
- | * byte:< | ||
- | for i in `find . -name ' | ||
- | for i in `find . -name ' | ||
- | </ | ||
- | * short:< | ||
- | for i in `find . -name ' | ||
- | for i in `find . -name ' | ||
- | </ | ||
- | * <code bash> | ||
- | for i in `find . -name ' | ||
- | rsync -avz --exclude-from=/ | ||
- | for i in `find . -name ' | ||
- | </ | ||
- | * <code bash> | ||
- | for i in `find . -name ' | ||
- | rsync -avz --exclude-from=/ | ||
- | for i in `find . -name ' | ||
- | </ | ||
- | * <code bash> | ||
- | for i in `find . -name ' | ||
- | for i in `cat listremove.txt | cut -d' | ||
- | for i in `find . -name ' | ||
- | </ | ||
- | ==== update gameloader and LoadInterface ==== | ||
- | <code bash> | ||
- | while read line; do i1=`echo $line | cut -d';' | ||
- | while read line; do i1=`echo $line | cut -d';' | ||
- | </ | ||
- | |||
- | <code bash> | ||
- | while read line; do i1=`echo $line | cut -d';' | ||
- | while read line; do i1=`echo $line | cut -d';' | ||
- | </ |
linux/bashscriptexamples.1437913440.txt.gz · Last modified: 2022/10/29 16:15 (external edit)