Created
November 18, 2021 15:49
-
-
Save mjm522/f35ffd3d1b913702f245e49a6c1d7b1c to your computer and use it in GitHub Desktop.
A bash file to read line by line from a file and the split the line to words using space as a delimiter.
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
#!/usr/bin/bash | |
input="full path to file" | |
while IFS= read -r line; do | |
arrIN=(${line// / }) ## to split with ; arrIN=(${line//;/ }) | |
## do something with the words, words can be obtained by ${arrIN[i]} where i is the index | |
done < "${input}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment