LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   bash script deleting rows (https://www.linuxquestions.org/questions/programming-9/bash-script-deleting-rows-924195/)

mr_twister 01-17-2012 05:15 AM

bash script deleting rows
 
Hi all, I have to create a bash script doing the following: ask in input a string, find that string into a file, then delete the all rows containing that string. Someone can kindly help me? I'm not so expert in scripting, I know linux commands.

millgates 01-17-2012 02:12 PM

Is this a homework? What have you tried so far? If you know linux commands then you should be able to solve the problem.

sycamorex 01-17-2012 02:28 PM

Google the following:

"bash read"
or
"positional parameters"
and
"sed"

Linux_Kidd 01-17-2012 03:29 PM

grep and sed are good ones, maybe just sed for the find and delete part. post what you come up with.

input is easy,
from groogle search

#!/bin/bash
# This script will test if you have given a leap year or not.

echo "Type the year that you want to check (4 digits), followed by [ENTER]:"

read year


All times are GMT -5. The time now is 06:46 AM.