LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-17-2012, 05:15 AM   #1
mr_twister
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
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.
 
Old 01-17-2012, 02:12 PM   #2
millgates
Member
 
Registered: Feb 2009
Location: 192.168.x.x
Distribution: Slackware
Posts: 852

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
Is this a homework? What have you tried so far? If you know linux commands then you should be able to solve the problem.
 
Old 01-17-2012, 02:28 PM   #3
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Google the following:

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

Last edited by sycamorex; 01-17-2012 at 02:29 PM.
 
Old 01-17-2012, 03:29 PM   #4
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash script: how to move files to Trash instead of deleting? KonfuseKitty Programming 1 07-10-2010 12:44 PM
deleting rows in text file in Perl shifter Programming 4 06-28-2010 07:10 PM
Deleting remote directories on multiple hosts with a bash script zirtik Programming 6 04-16-2009 09:52 AM
deleting 100 rows in text file (1-100) via terminal itz2000 Linux - Newbie 5 01-17-2006 11:19 PM
bash script, for deleting a specefic mail sn0wman Programming 8 01-16-2004 06:20 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration