1. Script To Find the Line Numbers In a Files For a Particular String
Syntax :- sed -n '/String_to_search/=' file_name.txt
Ex: sed -n '/LAST_UPDATE_DATE/=' XX_CONC_PROG.txt
2. Script To Change/replace the Line in a File
The Script is used to replace a line in a File for a Particular string in the Line
Syntax : sed -i '/String_in_a_line/ c\New_String_to_be_added ' XX_FILE_NAME.txt
Ex: sed -i '/LAST_UPDATE_DATE =/ c\LAST_UPDATE_DATE = "2013/07/17"' XX_FILE_NAME.txt
3. Script To replace a String in a File
The script is used to replace a String in the File.
Syntax: sed -i 's/String to Stearch/string_to_replaced/g' file_name.txt
Ex : sed -i 's/LAST_UPDATE_DATE =/LAST_UPDATE_DATE=SYS/g' XX_FILE_NAME.txt
Syntax :- sed -n '/String_to_search/=' file_name.txt
Ex: sed -n '/LAST_UPDATE_DATE/=' XX_CONC_PROG.txt
2. Script To Change/replace the Line in a File
The Script is used to replace a line in a File for a Particular string in the Line
Syntax : sed -i '/String_in_a_line/ c\New_String_to_be_added ' XX_FILE_NAME.txt
Ex: sed -i '/LAST_UPDATE_DATE =/ c\LAST_UPDATE_DATE = "2013/07/17"' XX_FILE_NAME.txt
3. Script To replace a String in a File
The script is used to replace a String in the File.
Syntax: sed -i 's/String to Stearch/string_to_replaced/g' file_name.txt
Ex : sed -i 's/LAST_UPDATE_DATE =/LAST_UPDATE_DATE=SYS/g' XX_FILE_NAME.txt
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.