I have a bunch of random files and I am going to run LINUX-file command on each file. Linux screen will be as follows
m7% file date-file.csv
date-file.csv: ASCII text, with CRLF line terminators
m7% file image-file.JPG
image-file.JPG: JPEG image data, EXIF standard
Only when Linux says that the file is a text file, I want to run a R script that goes through that file and finds all column names. In above screen, I want to run R script only on the first file. How could I achieve this conditional processing?
Is there any way I can run Linux commands from R? If i can do that then I can analyze the output given by Linux command to see if it contains text and then I can execute R script if required.
I am having difficulty achieving this and any help is appreciated