Sunday, November 13, 2005

AWK - Find - Delete Second Field/Column - One Liner 25 - 26

AWK


awk '/PATTERN/ {print "PATTERN FOUND"}' /var/awk_programming_test


This programming one liner allows you to search for PATTERN in awk_programming_test file. Once the pattern is found, the print statement is invoked .




AWK - Delete second column


Programming One Liner 26

awk ' BEGIN{FS=",";} { $2= ""; print}' /var/awk_programming_test


This programming one liner allows you to delete the second field in the specified CSV and the results are displayed on the screen. If the file /var/awk_programming_test had the following contents:



redhat,linux web server
fedora,linux web server
xp,windows dedicated server
windows 98,windows dedicated server
solaris,sun web server



Then invoking the one liner # 26 will produce the following results


redhat
fedora
xp
windows 98
solaris




Programming "One Liner" lookup terms:
awk





USE THIS PROGRAMMING ONE LINER AT OWN RISK AS AUTHOR CLAIMS NO RESPONSIBILITY.
If you would like more information on any of the commands, please feel free to contact me with your . You can also read other posts on programming code, lookup the programming terms displayed above or visit my network security blog. Other external , , and blogs.

GCC version - Programming One Liner 24

GCC: Finding the GCC Version


gcc --version


This programming one liner allows you to find which version of gcc (compiler) is installed on your linux server.


Programming "One Liner" lookup terms:
gcc

USE THIS PROGRAMMING ONE LINER AT OWN RISK AS AUTHOR CLAIMS NO RESPONSIBILITY.
If you would like more information on any of the commands, please feel free to contact me with your . You can also read other posts on programming code, lookup the programming terms displayed above or visit my network security blog. Other external , and blogs on Technorati .

List signal names - One liner 23

Signal Names


fuser -l


This programming one liner allows you to output signal names using fuser. Linux signal names are displayed as follows



[root@plain docs]# fuser -l
HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM
STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS
UNUSED



Programming "One Liner" lookup terms:
fuser

USE THIS PROGRAMMING ONE LINER AT OWN RISK AS AUTHOR CLAIMS NO RESPONSIBILITY.
If you would like more information on any of the commands, please feel free to contact me with your programming questions. You can also read other posts on programming code, lookup the programming terms displayed above or visit my network security blog. Other external blogs on Technorati and blogs.