#!/bin/sh ## /public/scripts/replacestr ## Replace one string by another in all files in current directory ## Input parameters are: ## 1. original string ## 2. target string ## Last modified: 11-FEB-2002 if [ $# -lt 2 ] then echo "" echo "Usage: $0 <original-string> <target-string" echo "Example: $0 123 abc" echo "" exit 1 fi FROMWORD=$1 TOWORD=$2 for i in `ls -l | awk '{print $NF}'` do if [ -f $i ] then sed 's/'$FROMWORD'/'$TOWORD'/' $i > $$.$i mv $$.$i $i fi done exit 0
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 1472 | Yariv Sheizaf | scripts dir |