Tag Archives: bash

Bash Assign Find Output To Array

To assign the output to an array, you need to use a command substitution inside of an array assignment. arr=($(grep -n “search term” file.txt | sed ‘s/:.*//’)) The inner $() runs the command while the outer () causes the output … Continue reading

Posted in Linux | Tagged , | Leave a comment