Wednesday, November 16, 2005

fr - Find and replace software tool for Linux

fr - find and replace text utility


##########################################################
### Find and Replace Script by Frank Mash ###
##########################################################
--> Usage: /sbin/fr [filename] [search] [replace] [b] [i]
--> ################# EXAMPLES #############################
--> EXAMPLE 1: Find 'Apples' and Replace with 'Oranges'. Create a backup of file and proceed in Interactive mode
----> fr /path/to/file.txt Apples Oranges b i
--> EXAMPLE 2: Find 'Apples' and Replace with 'Oranges'. Create a backup of file and proceed in Non-Interactive mode
----> fr /path/to/file.txt Apples Oranges b
--> EXAMPLE 3: Find 'Apples' and Replace with 'Oranges'. Don't create a backup of file and proceed in Non-Interactive mode
----> fr /path/to/file.txt Apples Oranges
--> ################# END EXAMPLES #########################
--> ################# NOTES ################################
----> Currently you cannot proceed in Interactive mode without creating a backup
--> ################# END NOTES ############################
--> You entered: /sbin/fr help


This custom programming one liner allows you to find and replace using one line. E-mail me at softwareengineer99 on Yahoo's e-mail service if you would like the source code.


Custom programming "One Liner" lookup terms:
fr sed grep

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.

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.


Wednesday, November 02, 2005

gunzip multiple files - Programming OneLiner 22

Gunzip


gunzip site*.gz


This programming one liner allows you to unzip / gunzip all files beginning with site and ending with .gz within the current directory


Programming "One Liner" lookup terms:
gunzip gzip

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 on Google.