≡ Menu

awk command

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…]

Sysadmin because even developers need heroes!!!

Bash: Pass Shell Variables To awk

How do I pass shell variables to awk command or script under UNIX like operating systems?
[click to continue…]

HowTo: Convert Between Unix and Windows text files

How can I convert newline [ line break or end-of-line (EOL) character ] between Unix and Windows text files?
[click to continue…]

Howto: Call Shell Script function In echo statement

I need to call the function called foo() using echo command in the same statement. How do I all or invoke the function using the echo statement?
[click to continue…]

Linux / Unix: Awk Print Variable

How do I print variables using Awk interpreted programming language under Linux or Unix like operating systems?
[click to continue…]

UNIX / Linux: awk Add Two Numbers

How do I add two numbers using awk? How do I calculate all incoming number stream on fly and display the total using awk?
[click to continue…]

How To Use awk In Bash Scripting

How do I use awk pattern scanning and processing language under bash scripts? Can you provide a few examples?
[click to continue…]

Awk Print Line After A Matching /regex/

How do I a print line after matching /regex/ using awk under Linux / UNIX operating systems? I’d like print the line immediately after a line that matches /regex/ but not the line that matches itself.
[click to continue…]

BASH: Prepend A Text / Lines To a File

I am a new Unix system user with a bash as a default shell. I can append text to a file using >> operator but how do I prepend a text to a file? I want the opposite operation of >>. How can I prepend some data to a text file?
[click to continue…]

Finding All Hosts On the LAN From Linux / Windows Workstation

Q. How do I find out if all host computers on the LAN are alive or dead from a Linux or Windows XP computer? My network subnet range is 192.168.1.0/24 and I’m using dual boot Debian Linux / XP SP2 computer.
[click to continue…]