Here's a way to add a line to the beginning of a file:
sed -i '1s!^!set timing on\n set time on\n set echo on\n!' batch1.sql_bkp
find . -type f -name '*.sql' -exec sed -i '1s!^!set timing on\n set time on\n set echo on\n!' {} \;
sed -i '1s/^/line_to_be_added\n/' file
Then, you could use the code above with find
to achieve your ultimate goal:
find . -type f -name '*.js' -exec sed -i '1s/^/line_to_be_added\n/' {} \;
No comments:
Post a Comment