Skip to content

Instantly share code, notes, and snippets.

@rothwerx
Created March 11, 2015 02:35
Show Gist options
  • Select an option

  • Save rothwerx/97c8c591be1021522b60 to your computer and use it in GitHub Desktop.

Select an option

Save rothwerx/97c8c591be1021522b60 to your computer and use it in GitHub Desktop.
Bash: resample the lines of a multiline variable
function resample() {
sample_interval=$1
fh=$2
ctr=1
while read line; do
[[ $sample_interval -eq $ctr ]] && echo "$line" && ctr=0
((ctr++))
done < <(echo "$fh")
}
resample 60 "$file_var"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment