$ sed -n '58p' file.txt
The '-n' option suppresses printing of all lines
$ sed -n '58p' file.txt
The '-n' option suppresses printing of all lines
Tuesday, July 26, 2005
Batch renaming of files
$ rename 's/\s+/_/g' *.mp3
Renames all mp3 files, stripping off all spaces and substituting it with underscore.
Saturday, July 23, 2005
The set command
#!/bin/sh
set `date`
echo "Time: $4 $5"
echo "Day: $1"
echo "Date: $3 $2 $6"
Returns:
Time: 01:33:02 EEST
Day: Sat
Date: 24 Jul 2005
The set command captures the positional parameters of `date` which has the format:
Sat Jul 24 01:33:02 EEST 2005
Positional parameters
myscript.sh:
#!/bin/sh
echo $0 $1 $2 $3
$ ./myscript.sh Running Ubuntu Hoary
./myscript.sh Running Ubuntu Hoary
$* contains all the positional args
$# contains the number of arguments passed
Thursday, July 21, 2005