≡ Menu

cut command

Unix / Linux Shell: Get Third Field Separated by Forward Slash (/) Delimiter

I'm writing a shell script for automation purpose. The output the path of the current working directory is stored in $PWD or it can be obtained using the pwd command. How do I find out find out 3rd field separated by the forward slash (/) delimiter using $PWD under Unix like operating systems?
[click to continue…]

awk / cut: Skip First Two Fields and Print the Rest of Line

I'd like to skip first two or three fields at the the beginning of a line and print the rest of line. Consider the following input:

This is a test
Giving back more than we take

I want my input file with the following output:

a test
more than we take

How do I printing lines from the nth field using awk under UNIX or Linux operating systems?
[click to continue…]

Linux: Parse an IP Address

How do I parse my Linux servers IP address using a Bash shell?
[click to continue…]