Last active
April 13, 2016 14:03
-
-
Save GiovanniBalestrieri/030eb87f8972e59859fbc3b05404414d to your computer and use it in GitHub Desktop.
[Bash] Append labels to file. Appends ,yes to positive and ,no to negative
This file contains hidden or 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 | |
# Path variables | |
csvPath="/tmp" | |
echo Please, enter the initial portion of the filename you want to modify | |
read filename | |
echo The following file will be modified: | |
file=$(ls -t $csvPath | grep -v NEG | grep TEST_POS_$filename | head -1) | |
echo "Labelled file: ${file}" | |
sed "s/$/,yes/" -i $csvPath/${file} | |
fileNo=$(ls -t $csvPath | grep TEST_NEG_$filename | head -1) | |
echo "Unlabelled file: ${fileNo}" | |
sed "s/$/,no/" -i $csvPath/${fileNo} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment