General :: Remove Words In A File Using Sed Or Any Other Command?

Nov 30, 2009

i want to remove words "Max" and "constrained" in a file given below:

Max 0.003745 constrained
Max 0.004549 constrained
Max 0.001689 constrained

[code]....

and further want to replace "Max" by line number so that i can plot the resulting file. i searched in forum, but couldn't do what i wanted to do. e.g. i used

1)grep command

grep -v "Max" inputfile >outputfile

deletes whole line,and hence whole text.

2) sed command

cat inputfile |sed 's/ .{1,12} //g' >outputfile

gives output

0.003745constrained
0.004549constrained
0.001689constrained

[code]....

View 4 Replies


ADVERTISEMENT

General :: Remove Duplicate Words Within A Particular Text In A File?

Jul 22, 2011

I am basically trying to remove duplicate words in my <title></title> tag after I got hit by Google Panda. I have around 750 .html files and it will be difficult for to me remove one by one. I am looking for a way to remove only from within <title> </title>

Example of a duplicate title I have:

Code:

<title>Pasta, Pasta Recipe and Pasta Guide</title>

I dont want to replace those words anywhere else in the file except for within the <title>

View 14 Replies View Related

OpenSUSE :: Look Command Fails Look /usr/share/dict/words - No Such File

Dec 20, 2009

How can I install the dict file to look works?

I am running SUSE 11.1

Here is the error:

View 2 Replies View Related

General :: Remove Words / Text In Directory?

Feb 24, 2011

I have a folder with many many files. e.g html, docs, excel sheet, script etc.
Now I want to find {using grep command}a certain word in that folder/directory and delete it in all the files and scripts that have it.

For example, I want to delete the word /testing (with the slash) in all files in a directory.

View 14 Replies View Related

General :: Shell Script Or Command To Remove PDF File From Large Logs?

Jul 13, 2011

I need to remove a large binary file(PDF file) from a large log file which is generated daily.This is seriously hogging space on our servers.I need to remove the large PDF from the logs to make the logs smaller and manageable

I need to take out the texts (or binary file) between the strings

<my:PDF> and </my:PDF>
<applicationForm> and </applicationForm>
<image> and </image>
<extractedSignature> and </extractedSignature>

I am not sure whether sed utility can do this, these are large files and need to be pruned .I am not seeking logrotation advice just a script or command that can strip these large logs of texts between the characters above . I am not sure how to do this.These files are rather large.I am not sure how to achieve this with sed , tail, head , tr or any other facility .

View 2 Replies View Related

General :: Add Quotes Between Words In A Cvs File?

Mar 8, 2010

I exported a spreadsheet file into cvs format.

The cvs file is formatted this way

field1,field2,field3,..etc

I want it to be in a Quote delimited format like so

"field1","field2","field3",..etc

View 2 Replies View Related

General :: Keeping A Constant Space Between 2 Words In A File?

Oct 6, 2010

I have a text file that gets produced at the end of the script being run.

For this example the text file will produce the following:

Quote:

THE COW
THE DOG
THE CAT
THE HORSE

In the script I am using either echo or printf to print on the screen each line and then it is doing a test and produces a good or bad result.

Another example:

Quote:

THE COW -- IS HOME
THE DOG -- IS HOME

Each whitespace between the -- are 5 spaces. How can I get them to be in-line and formatted when it gets to more words, when THE HORSE arrives.

Example:

Quote:

THE COW -- IS HOME
THE DOG -- IS HOME
THE CAT -- IS HOME
THE HORSE -- IS HOME <-- This has only 3 whitespaces but is still formatted.

View 8 Replies View Related

General :: Regex To Find Min / Max Length Words In File?

Jan 29, 2011

i am trying to find all 3 and 4-character length words in my file (which is huge and has alot of entries in it, a big fat wordlist!).My attempt with this regular expression (which I thought should work, found something on length search here: [URL]

cat sorted_noapostrophe.txt| grep '.{3,4}'

but it returns no results? Also to find any words starting with 'f' which are between 3 and 5 characters (inclusive) long, how can this be done?

View 4 Replies View Related

Software :: Check The Contents Of A Text File For A Specific String And Remove It From The File From The Command Prompt?

Oct 14, 2010

I want to be able to check the contents of a text file for a specific string and remove it from the file from the command prompt. I would basically be searching through a number of files and if a specific string is found I would like it removed automatically. pretty much a find and replace, were the replace is nothing. any one got any ideas on how you would do this. I already have the search part sorted just need to be able to remove the string I don't want from the multiple files.

View 4 Replies View Related

Ubuntu :: Remove All Double Or More Spaces From A Group Of Words?

Mar 7, 2010

How could someone remove all double or more spaces from a group of words? Is there a GUI program or CLI method or both? Example: I like to turn this:

[Code]...

View 2 Replies View Related

Programming :: Bash File Comparing - Report How Many Matching Words My Main File ?

Jun 9, 2009

I have been messing with diff and grep for 2 days now without result

I am trying to match a file consisting of words to many separate other wordfiles in a specific directory. one by one.

What i want the script to do is to report how many matching words my main file has with every file in the directory, each in turn

setup:

Each of em are plain text files with 1 word per line

Output should be something like:

SCRIPT REPORT:

View 8 Replies View Related

Ubuntu :: Output Of Command In Less And The Words Highlighted By Grep?

Sep 1, 2010

So theres this command

Code:
man -k mail
Which lists commands that contain the keyword "mail" in their description.I want the output of this command in less and the words highlighted by grep. Something like

Code:
man -k mail | grep mail | less
The command doesn't work, how do I fix it?

View 2 Replies View Related

CentOS 5 :: Command To Find And Remove Specific Letters From A File?

Nov 4, 2009

I have a file with tens of thousands of lines. I need to remove specific letters eg eggs, from every line that has the letters in it. Is there a command which can help me do that easily?

View 4 Replies View Related

Ubuntu :: Finding Words In File?

Apr 28, 2011

Is there a command that could be used to find word content in a file? I.e I want to find all files containing the word 169.254.0.0 in /etc directory.

View 4 Replies View Related

Red Hat / Fedora :: How To Locate Words In A File

Jul 6, 2010

I am using Oracle Enterprise Linux version 4 update 7.

Sometimes I have to access large files with thousands of lines in them and I would like to locate a particultar word. e.g.

vi /etc/passwd.

The contents of file passwd are displayed.I want to find a username of joe assuming the passwd file is 2000 lines long.

I would like to use a linux command that will locate joe and highlight in the passwd file as to where word joe is.

Is there a linux command that can do this?

View 5 Replies View Related

OpenSUSE :: Spaces Allowed In-between Words In A File?

Jan 12, 2011

I tried Suse five or six years ago and ran into an issue that was not comfortable to work with so I went back to windows. The problem was open spaces between words was not permitted with my music files. I have transferred all of my CDs and LPs to MP3 and have a tremendous number of them and the Suse of five years ago required I convert a title like Foggy Mountain Special.mp3 into something resembling Foggy_Mountain_Special.mp3

I don't care to convert literally a hundred thousand titles to fit the latter format. Does the current version of Suse allow the use of spaces between the words or is the 'no open space' convention still required?

View 9 Replies View Related

Ubuntu :: Deleting Duplicate Words In A Txt File?

Nov 14, 2010

i waas wondering if anyone knew of a script or program that removes duplicate words in a txt file. im making an install script and the install list has gotten a bit long so i want to ensure there are no duplicates in the file

View 2 Replies View Related

Ubuntu :: Capitalize Every Other Letter Of Words In File

Feb 19, 2011

i have this file, and considering it's obnoxiously huge i'd prefer not to have to do this manually. Is there some way i can manipulate sed or awk to change every other letter in all the words in a file to capital letters?

View 7 Replies View Related

Programming :: Highlight Some Key Words As Tailing A Log File Using A Perl Script

Oct 21, 2010

I'm trying to highlight some key words as tailing a log file using a perl script; about my case: I want to search for a keyworrs just once and highligt all occurrence of them. I want just highlit the keywords but not the whole line but the problems are that perl just catches the first keyword in a line and skip checking for other occurrence. for example if a line like "Error: some exception happen, Unable to process" it just highlight the error and do not process the remain part of the line where it should hilight the word "exception" and "Unable"

2-How can I do some action if for exapmle at least 4 time "unable" message appear ( not just in one line but diffrent line)in below is how I use perl search and replace : Code: s/(?:(unable|exception|warning))/e[1;31$&.......

View 2 Replies View Related

General :: Remove Write-Protected File - Will It Actually Delete The Password File?

Jul 30, 2010

When I ls -l /etc/passwd, -rw-r--r-- 1 root root /etc/passwd When I login as myself, and rm /etc/passwd, it asks: rm: remove write-protected file '/etc/passwd'? If I say yes, will it actually delete the passwd file?

View 1 Replies View Related

Ubuntu :: Getting Grep To Pull Info From A Specific File Which Match All The Words?

Jun 2, 2011

I am trying to use grep to only tell me files that include both words matching in a pattern file. However when i specify:

grep -f <pattern file> <file>

It pulls out anything that matches one or the other.

Not both.

how to get it to match AND not OR.

View 9 Replies View Related

General :: Downgrade And Remove Rpms In The Same Command?

Mar 22, 2011

I have a problem where in order to satisfy RPM dependencies, I need to remove packages and downgrade them in the same command. Imagine the following situation Before

A v2.0 depends on B,C
B v2.0 depends on C > 1.0
C v1.1

After

A v1.0 depends on C
C v 1.0

If I issue a

$ rpm -Uvh --oldpackage Av1.0.rpm Cv1.0.rpm

it will fail with "B depends on C > 1.0" If I issue a

$ rpm -e B

it will fail with "A requires B" so I appear to be in a catch-22. The obvious solution is to use a "--nodeps" and remove B before doing the downgrade, but I am creating these commands programmatically so I was hoping to use dependency resolution as a sanity check against an incorrect script. Is there any way to perform this downgrade without breaking the RPM dependency sanity checks by force?

View 2 Replies View Related

General :: Bash Command To Remove Spaces

Sep 14, 2010

I am reading the output of /proc/acpi/thermal_zone/ATF0/temperature in a program to read my CPU temp. I am using cat like the following:

Code:
#cat /proc/acpi/thermal_zone/ATF0/temperature
temperature: 49 C

I basically want to get rid of the spaces in between temperature and the actual temperature. Is there a command I can pipe the cat output to, to remove the spaces. I have seen suggestions for sed, or tr, but for some reason I cannot get them to work properly.

View 14 Replies View Related

General :: Pr Command How To Remove Page Numbering

Mar 26, 2010

When using the pr command for formatting simple text files for printing, page numbers are included in the header by default. I figured out how to remove the date from the header (pr -D ""), and how to remove the title (pr -h ""), but for the life of me I can't figure out how to remove page numbering from the header. Anybody know how/if this can be accomplished?

View 1 Replies View Related

General :: Route Command - Remove Iapddress

Jan 24, 2011

I am using this command for blocking some ipaddress. but now i want to remove iapddress. when i try # route delete 64.126.45.122 SIOCDELRT: No such process

View 1 Replies View Related

General :: Script Or Command To Find And Remove All KDE Traces From /usr/bin/?

May 2, 2011

1. Find everything that belongs to KDE in /usr/bin/

2. Show me what it is

3. (Give me an option to) delete it

A note about what did not remove mentioned;

Code:

apt-get remove kde --purge
apt-get autoremove

View 1 Replies View Related

General :: Append Command Output To File By Giving Command In Terminal?

Jul 3, 2009

I am using openSUSE 10.3.When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes).How can I append output of date to a file so I don't need two files?

View 4 Replies View Related

General :: Bash Command Needed To Remove Failed Install?

May 11, 2010

An app failed to load properly and now i'm stuck in a sequence I don;t understand the solution for.

sudo apt-get autoremove

dpkg was interupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

View 1 Replies View Related

General :: Del Command To Remove Files To Directory Instead Of Completely Deleting Them?

Dec 2, 2010

how to write a script so that when I use the 'del' command it removes/sends the files / folders to a I specify for example 'dustbin'

View 1 Replies View Related

Programming :: Use Regex In Perl Script To Detect Allowed Words From The File And Then Print Output To The Screen?

Oct 4, 2010

Its my first post in here so please be patient I am trying to use regex in perl script to detect allowed words from the file and then print output to the screen.

As an example : I have text file with orders and returns :

Item2-SKU-2-11.08.2010-online
Item3-SKU-3-11.09.2010-return
Item4-SKU-4-11.09.2010-store

My question: is it possible to make sure that i am ony outputing to the screen orders based on few conditions like Item,order form e.g. online.And is it possible to have multiple matches (Item2 only diplay if ordered online etc)

View 1 Replies View Related







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