android - Shell Script to remove lines of text in a text file -
how can remove line of text in file if exists?
so far guessing
#!/sbin/sh mount -o remount,rw /system; # create backup first cp /system/build.prop /system/build.prop.bak; # append if [ grep -o 'wifi.supplicant_scan_interval' <<</system.build.prop > 1 ]; echo "yo"; fi; mount -o remount,ro /system; however, shows me yo no matter of > 1 or < 1 (it exist in file), part seems wrong, also, don't know how remove line?
can help?
code update#!/sbin/sh mount -o remount,rw /system; function check_prop(){ busybox grep $1 /system/build.prop; homecoming $?; } # create backup first cp /system/build.prop /system/build.prop.bak; echo $(check_prop 'wifi.supplicant_scan_interval'); # append if [ $(check_prop 'wifi.supplicant_scan_interval') > 1 ]; # stuff here? echo 'yo'; fi; mount -o remount,ro /system; is returning me blank line, , yo. if alter < 1 same thing
sed '/wifi.supplicant_scan_interval/d' inputfile
would remove lines matching wifi.supplicant_scan_interval
eg
$cat input hello world hai $sed '/world/d' input hello hai if want delete line file utilize -i alternative action inplace
sed -i '/wifi.supplicant_scan_interval/d' inputfile edit
using grep print lines except lines match patter.
grep -v 'wifi.supplicant_scan_interval' inputfile eg
$ grep -v 'world' input hello hai the -v alternative negation.
android bash shell sh
No comments:
Post a Comment