Last active
January 4, 2016 02:59
-
-
Save sthesing/8558909 to your computer and use it in GitHub Desktop.
Replace script for app.net's @nhk using sed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Cut extension off | |
FILENAME=`echo $1 | cut -d'.' -f1` | |
#Put [$FILENAME][S. ] before everything in double quotes | |
sed -i 's|\(\".*\"\)|['$FILENAME'][S. ]\1|g' $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have a file
foo.txt
with the following content:If you run
./nhk_replace.sh foo.txt
, the script replaces the content with: