Created
June 18, 2014 21:50
-
-
Save danielecook/188f2a7c9cb15d52b8ee to your computer and use it in GitHub Desktop.
In conjunction with included bash, concatenates multiple files within folders (with foldername and filename)
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
library(stringr) | |
library(dplyr) | |
""" | |
# Generate concatenated worm_track data using the following | |
for folder in `ls -d *\/`; do | |
for file in `ls $folder/worm*`; do | |
cat $file | awk -v file=$file '{print file","$1}' >> worm_track_all.txt | |
done; | |
done; | |
""" | |
names(worm_track_all) <- c("Folder","time","x","y","blps","mmps") | |
worm_track_all[,c("Folder", "Filename")] <- str_split_fixed(worm_track_all$Folder, "///",2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment