Posts
read more
Processing a List of Files from an Input File
Suppose we have a list of files stored in a text file and we want to perform an operation on each of them within a bash script. How would we go about doing that? Well, there are several options, here are a few.
$ cat input-files.txtfile-1.txtfile-2.txtfile-3.txtfile-4.txtfile-5.txtfile-6.txtfile-7.txtfile-8.txtfile-9.txt
Posts
read more
String Processing with Bash
There are various tools built into bash that enable you to manipulate a variable or string which come in handy when writing shell scripts. Here are a few notable ones:
Find the length of a string
${#string}
Get a Substring from a String
${string:pos} or ${string:pos:len}
Removing Substrings from a String
${string#substr}${string%substr}${string##substr}${string%%substr}