Handy bash code

Rather than thinking about it every time, I’m collecting all my handy bash things.


for file in $(ls|grep mp3)
do
ffmpeg -i $file ${file/mp3/wav};
done

Takes all the foo.mp3 files, use ffmpeg to convert and output foo.wav


for file in *.png
do
mv "$file" "${file/_h.png/_half.png}"
done

Regular expression on file names. Change something_h.png to something_half.png

Command to put memory contents in excel spreadsheet (so I can copy paste lol):

Memory content in the form of:

0x2e
0x2f
0x30
0x31
0x32
0x2f
0x33
0x31
0x34
0x35
0x30
0x31
...

Want to output them out in the form of:

...
0x31 0x30 0x35 0x34
0x31 0x33 0x2f 0x32
0x31 0x30 0x2f 0x2e

Use the following:

head -256 copyenc | tac | awk '{if (NR%4) {ORS="\t";print " "$0} else {ORS="\n";print " "$0}}' > enc_lut_txt

Advertisements

About collapsedwavefn

I have a lot of thoughts. Some of them I'd like to share.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s