Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deleting/Removing sentence from .txt Post 302492138 by santonio on Sunday 30th of January 2011 02:44:55 AM
Old 01-30-2011
Deleting/Removing sentence from .txt

Hi,

now i need to remove the entires i inserted into my .txt file.

Code:
    echo -n "Title: "
    read Title
    echo -n "Author: "
    read Author
    if grep -q "$Title: $Author" "BookDB.txt"; then
	sed '$Title: $Author' BookDB.txt
	echo "Book Title '$Title' removed successfully!"		
    else
	echo "Error! Book does not exists!"
    fi

my sed command doesnt seems to work. my BookDB.txt contains the Title, Author and price of the book. Required to delete the whole sentence just by the input of Title and Author.

For E.g

ABC:John:5

where ABC = Title, John = Author, 5 = Price.

Much help would be appreciated =)

Last edited by Yogesh Sawant; 01-30-2011 at 05:30 PM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's, I need to create 3 files with the contents "ABC" using single command. Iam using: echo "ABC" > file1.txt file2.txt file3.txt the above command is not working. pls help me... With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies

2. Shell Programming and Scripting

Script for removing text from a txt file

Hello, So I wanted to write a very simple script to remove some information from a text file and save it as something else. For example I have a text file (let's call it txt) with three rows of numbers: 0 0 1 9 8 7 5 0 6 7 9 0 0 7 9 8 1 1 6 4 0 6 0 0 9 8 4 6 0 9 2 8 1 And I want to... (2 Replies)
Discussion started by: hertingm
2 Replies

3. Shell Programming and Scripting

Deleting lines that contain spaces in a txt file

I need some help deleting lines in a file that contain spaces. Im sure awk or sed will work but i dont know much about those commands. Any help is appreciated :D (7 Replies)
Discussion started by: r04dw4rri0r
7 Replies

4. UNIX for Dummies Questions & Answers

Script to ask for a sentence and then count number of spaces in the sentence

Hi People, I need some Help to write a unix script that asks for a sentence to be typed out then with the sentence. Counts the number of spaces within the sentence and then echo's out "The Number Of Spaces In The Sentence is 4" as a example Thanks Danielle (12 Replies)
Discussion started by: charlie101208
12 Replies

5. UNIX for Dummies Questions & Answers

Deleting lines in .txt with nonspecific value

Hello, i am new to the forum and know nothing about programing, Linux or Unix :( hope somebody can help me out. I have a .txt file that i need to delete certain lines from. After searching the forum i noticed that using "sed" was the way to go, so i installed gnuwin32 (i use windows xp... (4 Replies)
Discussion started by: luis3141
4 Replies

6. Shell Programming and Scripting

Deleting pattern without removing line

I am trying to delete a pattern without removing line. I searched a lot in this forum and using those I could come up with sed command but it seems that command does not work. Here's how my file looks like: 1 ./63990 7 1171 ./63990 2 2425 ./63990 9 2539 ./63990 1 3125 ./63990 1 10141... (7 Replies)
Discussion started by: shoaibjameel123
7 Replies

7. Solaris

Something is removing/deleting my wtmpx file?

hi, we have a solaris 10 box that was handled by a different sysadmin before & now it is turned over to us for system administration. our concern is that if we issue the "last" command, it usually says "wtmp begins current day current month date 02:30". just like this "wtmp begins Thu Mar 7... (6 Replies)
Discussion started by: booghaw
6 Replies

8. Shell Programming and Scripting

Removing inline binary data from txt file

I am trying to parse a file but the filehas binary data inline mixed with text fields. I tried the binutils strings function , it get the binary data out but put the char following the binary data in a new line . input file app_id:1936 pgm_num:0 branch:TBNY ord_num:0500012(–QMK) deal_num:0... (12 Replies)
Discussion started by: tasmac
12 Replies

9. Shell Programming and Scripting

Deleting Repeating lines from a txt file via script

Hi, I'm having trouble in achieving the following scenario. There is a txt file with thousands of lines and few lines are repeated, which needs to be removed using a script. File.txt 20140522121432,0,12,ram Loc=India From=ram@xxx.com, To=ravi@yyy.com,, 1 2 3 4 . . 30... (18 Replies)
Discussion started by: Gautham
18 Replies

10. UNIX for Dummies Questions & Answers

Removing PATTERN from txt without removing lines and general text formatting

Hi Everybody! First post! Totally noobie. I'm using the terminal to read a poorly formatted book. The text file contains, in the middle of paragraphs, hyphenation to split words that are supposed to be on multiple pages. It looks ve -- ry much like this. I was hoping to use grep -v " -- "... (5 Replies)
Discussion started by: AxeHandle
5 Replies
Bio::SeqIO::game::gameHandler(3pm)			User Contributed Perl Documentation			Bio::SeqIO::game::gameHandler(3pm)

NAME
Bio::SeqIO::game::gameHandler -- PerlSAX handler for game-XML SYNOPSIS
This modules is not used directly DESCRIPTION
Bio::SeqIO::game::gameHandler is the top-level XML handler invoked by PerlSAX FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Sheldon McKay Email mckays@cshl.edu APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ start_document Title : start_document Function: begin parsing the document end_document Title : end_document Function: finish parsing the document load Title : load Usage : $seqs = $handler->load Function: start parsing Returns : a ref to a list of sequence objects Args : an optional flag to supress <computation_analysis> elements (not used yet) s_game Title : s_game Function: begin parsing game element e_game Title : e_game Function: process the game element e_seq Title : e_seq Function: process the sequence element e_map_position Title : e_map_position Function: process the map_position element e_annotation Title : e_annotation Function: process the annotation perl v5.14.2 2012-03-02 Bio::SeqIO::game::gameHandler(3pm)
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy