In a Bash script, I want to pick out N random lines from input file and output to another file.
How can this be done?
Use shuf with the -n option as shown below, to get N random lines:
shuf
-n
N
shuf -n N input > output
How to generate a random number within a range in Bash?
In PHP, strings are concatenated together as follows: $foo = "Hello"; $foo .= " World"; Here, $foo becomes "Hello World". How is this accomplished in Bash?
What command can be used to check if a directory exists or not, within a Bash shell script?