Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells, Text Processing

Passing shell variables to awk and sed

Submitted by on December 2, 2005 – 10:23 amOne Comment

By default awk and sed do not expand shell or system variables and do not pass their own variables back to the shell. To use shell variables awk and sed statements must be included in double-quotes. Here are a few examples:

1) You have a file (words.txt) containing a list of words and their replacements as shown below.

You also have a text file (text.txt) where you need to replace the words from the list above with the corresponding alternatives.

Here’s a shell script to do it:

The resulting text.txt file would read:

  • Joey 01

    What are some real-world applications that involve a systems of linear equations? How can the graphing display calculator assist in determining the solutions of the system?

    can you gues be very brief ?