General :: Deleting A Line Containing The Word?

Jun 10, 2010

what would be the syntax to delete a line containg the word "word" from the file "file" i want to delete the whole line and not only the word...

View 6 Replies


ADVERTISEMENT

General :: Search Word And Delete Only The Word And The Line Using Sed Command?

Jun 28, 2011

Want to search for ~ and delete it as well as to append the entire line to the above line. For Ex:

1111xxxx date Sandy area is ~around this area.3222xxx date There seems to ~left side of map, the colours are accurate (showing green areas)Even if I ~zoom in, the green parks, xxx3258 date The dammed up
~away, the "other" body of water varies ~blackNatural gas leaching.

IT MUST LOOK LIKE:

1111xxxx date Sandy area is around this area. 3222xxx date There seems to left side of map, the colours are accurate (showing green areas)Even if I zoom in, the green parks, xxx3258 date The dammed up away, the "other" body of water varies blackNatural gas leaching.

View 4 Replies View Related

General :: Sed Append Word At End Of Line If Word Is Missing

Feb 19, 2010

I have to modify formsweb.cfg file in Oracle IAS.

Problem description

In formsweb.cfg file are two lines with labels archive_jini= and archive= at the beginning of line. After equal sign (=) is row of filenames of java archives delimited by coma(,). When I insert a new jar file in java directory, I have to append the very same name of jar file to both lines if that name is not yet present.

Example snippet from formsweb.cfg

View 2 Replies View Related

Programming :: Deleting Lines Above And Below A Word

Mar 25, 2011

i jst want to delete a host entry from httpd.conf the entry for lal.com should be deleted!!

View 14 Replies View Related

General :: Get A Word From A Line Using Sed Or Grep

Mar 30, 2010

I am trying to get a word from a line using sed. Following is the line which I want to use.

inet addr:10.245.86.15 Bcast:10.245.87.255 Mask:255.255.254.0 inet6 addr: fe80::1031:3dff:fe01:55e1/64 Scope:Link

From the above line, I need the ip address like 10.245.86.15 only.

View 4 Replies View Related

General :: SED - Substitute A Word Only In A Certain Line

Feb 2, 2010

I tried to use the command:

sed -i ''$line_number',/port/s/port/portMARKED/' file

to substitute the word "port" by the word "portMARKED" at the specific line that is saved in "line_number". The substitution happens, but it is copying my line twice... and I have no idea why... I need to make a single substitution of one word for another at a certain line in my text file. Would somebody know how I could do that?

View 3 Replies View Related

General :: Edit Last Word On Each Line In File?

May 28, 2010

I have a file which a number at the end of each line. I need to change this number in the file to be correct, i.e. each time the number is 9 it needs to be 1, each time it is 233 it needs to be 2, etc... There is no pattern to the numbers currently in the list other than the same number appears only in a single line/group of lines, not throughout the file, but the replacements need to be sequential (but can be repeated an arbitrary number of times).

[Code]....

View 10 Replies View Related

General :: Deleting A Specific Line Which Contains 2 Patterns?

Apr 7, 2011

i have a problem about deleting a line from a text file which contains two specific patterns. i am using "sed -i "/$name/ d" peop.txt" but i must use one more variable which is surname.

"
burak:ak:3242:2342:dsa@a.com
gokhan:an:432:4234:da@a.com
"

and this is the code of text file. and the second question when i use "/$name/ d" it deletes not only the names which are macthing with $name but also all words that contain $name. so how can i fix these problems_?

View 2 Replies View Related

General :: Script For Deleting Matched Line Of File From Another

Sep 3, 2009

I have two text file named 1.txt & 2.txt.

1. txt contains 5 laks of mobile number.
2. txt has 60 laks of mob no.

Situation is that I want to find and delete numbers in 2.txt which already in 1.txt. Any perl or bash script or any other way to get the work done.

I tried the following:
#! /bin/bash
IFS=$'
' for NAME in $(cat one.txt)
do sed -ie "|^$NAME$|d" two.txt done
echo "***DONE***"

It works well with smaller file but it take very very long time even processing 10 thousand numbers.

View 2 Replies View Related

General :: Deleting First Line With Unique String Then All Subsequent Lines Thereafter?

Jan 20, 2011

I am doing molecular dynamics where I have to edit files. I have looked at tutorials for grep and sed but can't find my solution. The files produced in my simulations look something like this:

ATOM 1825 NE2 GLN 112 113.646 27.895 14.456
ATOM 1826 HE21 GLN 112 114.020 26.957 14.490
ATOM 1827 HE22 GLN 112 112.649 28.039 14.388

[code]...

View 5 Replies View Related

Programming :: Deleting Line By Line From A File?

Apr 21, 2010

this script returns me :

sed: -e expression #1, char 2: extra characters after command
sed: -e expression #1, char 2: extra characters after command

Code:

#!/bin/bash
while read line
do
sed -i "$line" 'd' test.txt
done < test.txt

View 12 Replies View Related

Programming :: Check Command Line For A Word?

May 23, 2010

I'm building a script for my place of employment. The next step in it is checking what the user input was. Determining if they added a part in there or not. The script prompts for a hostname. Hostnames are localhost.localdomain. Now, I want the script to check to see if they put localdomain and if they did, not to add the domain to the /etc/sysconfig/network, but just what they entered. So say the user inputs:

[Code]....

View 4 Replies View Related

Ubuntu :: Deleting Grub Line?

May 25, 2010

I upgraded to 2.6.33 and my comp will only run in Low graphics mode so i scroll down one level back to 2.6.32-22 and all is fine.How can i 'erase' the 2.6.33 line (and the associated recovery line)from the grub list so i dont have to deal with it till bugs are removed later on.My Grub header says it is version 1.98-1ubuntu6

View 3 Replies View Related

Ubuntu :: Add Word To Each Line In A Gedit Text File?

Dec 8, 2010

Using the latest version of Ubuntu desktop on an emachine t5062 if it matters. I have a text file of keywords that is one-three words line after line for like 5000 lines. How would I go about adding a word to each line.Aside from typing it in or copying and pasting.If it can`t be done with Gedit I am all for using another program.

View 8 Replies View Related

Programming :: Bash Script - Grepped A Log File To Obtain Every Line That Contains A Word

Dec 8, 2010

I have grepped a log file to obtain every line that contains a word (let's call it 'blah'). I now want to only display a list of entries within that search result that feature the word 'host' anywhere in the line, and I also want to display the single word *after* 'host' (up until the next space). So, the end result will look like this:

[Code]....

View 8 Replies View Related

Security :: Site Hacked - Deleting Specific Line From Files Recursively?

Apr 26, 2011

I just got an email from google saying my site contained malware. It has a line in it: "<script src='http://whitepix.info/3'></script>". I've noticed its recursively in all my .html and .txt files in my website. Can I make a linux script to run that will go through all my .html and txt files recursively and delete that line from them? I don't know how it got in all of them.

View 6 Replies View Related

Programming :: Read Two Files Word By Word At A Time Using Any Loop By Shell Script?

Mar 4, 2010

Well, I am facing one issue:How can i read two files word by word at a time using any loop as i need word by word comparision in shell script?Please let me know pseudo code.

View 14 Replies View Related

Programming :: Bash Shell Script Read File Word By Word?

Jan 21, 2011

I have a output file look like this:
{"test1" : "test2", "test3" : "test4"},

How can I read word by word in each line?This is not working code:

a=0
while read word
do a=$(($a+1));

[code]...

View 14 Replies View Related

General :: Next Word Of A Particular Word ?

Feb 9, 2011

In linux is there a way to find the next word of a particular word of a file. grep displays entire line of the particular word. But i want only the exact next word of that particular word.is there any command for that.

View 13 Replies View Related

Programming :: Bash Read Input Word For Word ?

May 4, 2010

I am pretty new to bash scripting...I am trying to write a script that will take an input and read it word for word and then DO something with it like echo. I have been able to find how to read word for word from a file but I don't know how to do it with input.

I was looking for something like

Code:

exit 0 The input would be A-Z a-z 0-9 and have a single space between each word.

View 2 Replies View Related

General :: How To Convert Word - Doc - To PDF ?

Jun 24, 2010

I have a set of files in .doc format, that need to be converted to .pdf format. I am using Ubuntu linux.

View 7 Replies View Related

General :: How To Add Word At The End Of File

Sep 13, 2010

I'm trying to add a word at the end of a file that already contains data. I need to do it using a single command without human interaction cause it's gonna be part of an automatic script.

View 2 Replies View Related

General :: Word Autocompleteion In Vi

Jan 29, 2010

I want to add word autocompletion feature to my vi editor.my .dict file contains C++ keyword(near about 90 words).

View 2 Replies View Related

General :: How To Turn Off Word-wrap In Less

Apr 19, 2011

How can I make the less utility in Linux not wrap lines?

Long version: Often I need to view huge CSV files using less with hundreds of columns. I frequently only care about the first couple columns. However, word wrap causes one line to become several lines even on wide-screen monitors.

View 2 Replies View Related

General :: Bold Word In Mail

Jul 21, 2010

I have a script to output the result ( eg. echo $x ) , then send result to my Lotus mail server , can advise if I want to bold the words in the mail , what can i do ? thx

View 2 Replies View Related

General :: How To Convert Word Or Pdf To Html

Nov 11, 2009

I want to use an utility to convert word,pdf to html with same formatting. that utility able to run in commandline also. i want to integrate it in web page. so which utility is suitable for it

View 9 Replies View Related

General :: Extract The First Word Following A String?

Aug 22, 2010

I need a bash script that can read a file, say example.txt search for the string "This is my example string" and save whatever word/number comes immediately after it to a variable, var.

Example:
blah blah
blah This is my example string extracthere is a very nice word.
blah blah

There are two constraints:1. This needs to assume as little as possible about the nature of the known string "This is my example string" and the word that follows it. I am trying to keep my code adaptable.2. Speed is valuable. This shell will be executed dozens if not hundreds of times so speed is very desirable. I thought I read that some commands are faster than others.

View 14 Replies View Related

General :: Inserting Same Word On Different Lines In Vi

Aug 2, 2011

I am having problem in adding a word in same place on different line in vi editor (/bin/bash).

View 4 Replies View Related

General :: Keep Duplicates Based On First Word Only

Mar 11, 2011

I have a large file and want to keep lines which are duplicates, but the test for duplicates is performed only on the first blank-delimited word.

View 6 Replies View Related

OpenSUSE Install :: Arial-KOI Type, The "è" Word Is Replaced By A "X" Word?

Aug 3, 2011

Found a font bug: in the Arial-KOI type, the "è" word is replaced by a "X" word...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved