INSTALLATION DOCUMENTS BY RAVI

Thursday, May 11, 2017

sed command to add a line in nth place of a file in linux

Command to add a string in nth line of a file:

sed -i '8i string to add' filename

8: stands for 8th line in file
i: insert

The above command will add the string in 8th line of all the file.

Command to add a string in nth line of all files in a directory:

sed -i '8i string to add' *

The above command will add the string in 8th line of all the files in the directory.


sed -i '8i string to add' filename*.txt

The above command will add the string in 8th line of all the files with extension .txt in the directory.

No comments:

Post a Comment

SQL query to find whether OdiSendMail is configured or not ODI 12c

In the SQL developer connect to the ODI work repository user (Ex: DEV_ODI_REPO) and run the below query. select SCEN_NAME,TASK_NAME3,DE...