lets-hack / hack-a-day

for our hack-a-day stuff
1 stars 0 forks source link

create a ls to property file generator #1

Open gsharp opened 9 years ago

gsharp commented 9 years ago

using one line, parse lines of output to a properties file format

open terminal and go into a directory:

cd ~/Desktop

get a list of files:

ls

using one line, do the ls and parse the output of ls into this format:

files=file1,file2,file3….etc

and save the output to a file called

files.txt

rules:

You should be able to test your result with:

cat files.txt

answer is here when you want it:

https://gist.github.com/gsharp/9d1cfe60789a5cc8504c

r1beast02 commented 9 years ago

ls | tr '\n' ',' | sed 's/^/files=/' | sed '$s/,$//' > hack.txt; cat hack.txt

gsharp commented 9 years ago

bad ass!