Write a Shell script that deletes all lines containing a specified word in one or more files supplied as arguments to it.
AIM:
Write a Shell script that deletes all lines containing a specified word in one or more files supplied as arguments to it.
Program:
## for this program we have to create one or more files (optional),
## I am creating two files names are del ,dell.
[root@localhost ~]# vi del
unix is os
dos is also os
here using unix
unix is powerful os
~
[root@localhost ~]# vi dell
windowsnt is also os
there are some difference between unix and windowsnt
but unix is great among all os
## after creation two files now we have to write sed script file name is del.sed using vi editor.
[root@localhost ~]# vi del.sed
{
/os/d
}
Output:
[root@localhost ~]# sed -f del.sed del dell
here using unix
there are some difference between unix and windowsnt
-
UpdatedNov 05, 2014
-
Views24,531
Write a Shell script to find factorial of a given integer.
Write in C the following Unix commands using system calls A). cat B). ls C). mv
Write a Shell script that displays list of all the files in the current directory to which the user has read, Write and execute permissions.
Write a Shell script that accepts a filename, starting and ending line numbers as arguments and displays all the lines between the given line numbers.
Write a C program to emulate the Unix ls-l command.
Write a Shell script to list all of the directory files in a directory.