Ubuntu :: Add / Remove Bits Of Text From A Text File

Dec 6, 2010

I am looking for a way to keep a log and make if then statements if a line exitsts in the log. I also am looking for a way to make a simple loop, like goto line number, and I also am wondering how to add/remove bits of text from a text file (plugins line in server.properties)

View 5 Replies


ADVERTISEMENT

Programming :: Remove Lines In A Text File Based On Another Text File?

Jan 28, 2009

I have a text file called file1.txt containing many lines eg.

line1
line2
line3
line4
line5
line6

Then i have another text file called file2.txt contains

3
5
6

Is there a command to remove the lines in file1.txt based on the keywords in file2.txt? note: It should remove line3,line5,line6 based on 3,5,6

View 10 Replies View Related

Ubuntu :: Sort The Output To A Text File So That It Prints To The Text File At 1 Process Per Line?

Feb 6, 2011

im trying to output a list of running processes via a shell script. At the moment i got this which outputs the processes to a text file called out.

echo $(ps aux) >>out

The problem is though, the processes are all just one big block of text which makes it hard to read. Does anyone know how to sort the output to a text file so that it prints to the text file at 1 process per line? I know its probably simple but im very new to linux.

View 5 Replies View Related

Ubuntu :: Remove Repeats In Text File

Jul 5, 2011

I have 2 lists of names, they aren't sorted, and may contain repeats.What I would like to do with a bash script is compare the 2 documents and find and remove each repeat name, saving only one of them. Then concatenate the files. Or if it were easier, concatenate first and find and remove all internal repeats.

View 5 Replies View Related

Fedora :: F14 Gnome Text/plain Versus Text/html File Type

Apr 2, 2011

I put a text file on my desktop and added a couple lines of text with gedit. File type shows text/plain. Double-click opens the file in gedit which is what I want. I'm using the file to temporarily hold some snips of code that I copy from file to file, but when I copy some html into the file and save it, now file properties show it's text/html and a double-click opens the file in firefox, which isn't what I want. Is there some way to keep the file type from changing itself?

View 6 Replies View Related

Ubuntu :: Python : Remove Some Lines From A Text File?

Sep 6, 2010

I am creating my own address book Python program and I want to create a nction that removes some specified entries. The code looks like this now.

Code:
def remove():
delentry= raw_input('Enter the entry name to delete: ')

[code]...

View 1 Replies View Related

Ubuntu :: Remove Duplicate Lines From A Text File?

Dec 16, 2010

Contained within each of these 67 text files is about 1 million urls. Yes. I have 67 text files that contain 1 million lines of urls each. I am sure I am swimming in duplicates. I tried opening one text file and clicking sort ----->remove duplicates. Now Gedit is not responding my processor is maxed out to 100% and I think I am finally ready to delve into some command line code. Can anyone give me idiot proof instructions on how to sort the duplicates out of each one of these 67 text files? How about no duplicates across all 67?

View 7 Replies View Related

Software :: Use Sed To Include A Text File In The Beginning Of Other Text Files Inside A Folder And Its Subfolders?

Jun 1, 2010

Can I use sed to include a text file in the beginning of other text files inside a folder and its subfolders? So it should be recursive.

View 4 Replies View Related

Server :: Remove String In Text File?

Jun 5, 2009

I have a text file which include code...

I mean, this string should be removed from each line and save in another file.

View 9 Replies View Related

Programming :: Adding Lines Of Text To Beginning Of Text File

Jan 19, 2009

I need to insert 3-4 lines of text to the beginning of a text file. The file is a largish MYSQL dump, the result of a backup shell script. This shell script should insert the required text.I've wrestled with sed, but lost.

View 2 Replies View Related

Programming :: Delete Line Of Text From Text File Via Shell?

Jan 13, 2010

I have to delete a certain line of text from the a textfile via ubuntu's shell scripting.I have done research, and it seems that most people advocate the usage of sed /d option. sed makes does not edit the text file. Hence, most options I discovered involved the use of a temporary variable/textfile and then overwriting the old file with the temporary new file. Is there anyway whereby I can bypass the use of temporary storage containers? I hope there is any magical combination of commands to edit the file directly.

View 3 Replies View Related

Programming :: Exporting Glade Text View To Text File?

Jan 8, 2011

I want to display something in my text view widget in glade using c code. that's all right.
now I need to attach a save button beneath the text view.so that on click the text view content should save as a txt file..

View 8 Replies View Related

Programming :: Formatting Fields And Text Being Displayed From Text File?

Feb 9, 2011

I want to display the contents of a particular log file (simple text file, I mean in Linux). But there is a problem: The contents need to be organized in a fixed format. Have a look at this log file:

sampleLog.txt

Code:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!

[code]....

So, while displaying the contents of above file on a web page, I want to format the field names found in the log file: User Name:, Reported Problems Description:, and Remarks:. These fields may contain a variable length of text and no specific line number is assumed for them to appear on.

The desired output should look like this:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!

[code]....

Well, what I am trying to do may sound wierd to some of you. The filed "Reported Problems Description:" can possible contain text which embeds colon (.

View 15 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 Duplicate Lines In Plain Text File?

Apr 14, 2010

i have a big file of random numbers i generated at some point in time, after working with it with different things(how fun that was)... i want to remove duplicate lines and i'm not sure i'm doing this right

heres the command

Code:
sort random.txt | uniq -u > rand-shorter.txt

the file is pretty big, everything on a new line. i found the command on a web site so i'm sure its correct(bit of a command line in linux newbie)

can anyone confirm if this will remove lines duplicate lines (keeping one copy) and dump what is left in a file named rand-shorter.txt?

EDIT: i think its actually working, just taking a reallllly long time (on an old pen 4 from 2000)

View 8 Replies View Related

Programming :: Add Text Before Line Number In Text File?

May 3, 2010

a sed command to add a text before line number in text file? I have text file with 500 lines, and i want to add 3 more lines with text after line 300, OR before line 302, isn't no problem.

View 16 Replies View Related

General :: Remove All The <a Href Links From Text File?

Mar 24, 2010

[Code]....

I am trying to remove <a href links using SED but unable to do it.

The finale result I am looking for is

[Code]....

Is it possible with Linux or should I try with Php?

View 2 Replies View Related

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

General :: Remove Lone Lines From A Text File?

Jul 6, 2011

anyone has ideas how to remove lone lines from a text file?

If I have a file that is like this:
-----------------------------------
line 1

[code]...

View 14 Replies View Related

Software :: Remove Specific Text Blocks In A File?

Jul 1, 2010

I have a text file (actually a log file from a sensor) that looks like this:

Date/Time: 10.07.01 11:03:59
00 Battery Voltage 13.5 Volt
01 Reference 71
02 Wind speed 6.68 m/s
03 Wind gust 9.3 m/s

[Code]....

I want to delete every block that is not complete. If any of the above lines (Date line or lines 00 to 08)is missing I want to completely remove the block.

View 1 Replies View Related

Fedora :: Install / Remove Packages Written On A Text File?

Sep 9, 2010

I use the show-leaves yum plugin, and sometimes I use that info to remove some unnecessary packages. But that list can be long, so I write them on a text file.

1) Instead of removing packages one by one is there a way to remove all packages written in that text file?

2) Why isn't the output of the show-leaves plugin compatible with the output of "package-cleanup --leaves"?

View 1 Replies View Related

OpenSUSE :: Possible To Remove Multiple Packages Listed In A Text File?

Sep 15, 2011

Is it possible to remove multiple packages listed in a text file? Similar to "cat orphan.txt | zypper rm" or "zypper rm <orphan.txt." Neither worked.

View 8 Replies View Related

General :: Remove Lines From A Syslog Text File That Have Duplicate Strings

Mar 17, 2011

Trying to remove lines from a syslog text file that have duplicate strings

Mar 10 06:51:11[http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360]

then a few lines down

Mar 10 06:52:03 [http-8080-1] INFO com.MYCOMPANY.webservices.userservice.web.UserServiceController [u:2533274802474744|360] Authorize [platformI$tformIdAndOs=2533274802474744|360, userRegion=America|360

got the same thing in terms of a u: number but the issue is I need to remove duplicates and just leave one and the file has multiple duplicates of different u: numbers and it's 14,000 lines long. can anyone tell me if I can use awk? sed? or sort for something like this to? removing lines that have a certain string in there that's a duplicate.

View 4 Replies View Related

Fedora :: Text File Manipulation With Standard Commands In BASH - Remove The Stock Code

Oct 10, 2009

I need to do some text file manipulation which I think should be done with standard commands in BASH. I'm looking at comma seperated text files (stock market data). It comes in the form of date, stock code, open, high, low, close, volume. What I need to do first is move all data with same stock code sequentially into individual files.

While doing this since the stock code will now be the file name I need to remove the stock code. Next I need to filter out overlapping data from different files with the same date. ie. where two files contain the same date on the one line only one line will be added to the combined file. I think there must be a tutorial out there for basic text manipulation like this, I just haven't found it yet.

View 11 Replies View Related

General :: Replace Text In One File With Text From Another File Using Sed?

Apr 28, 2010

How could I replace text in one file with text from another file using sed?

The text in each of the files would be surrounded by a starting and ending delimiter or a starting tag, say like /* */ so to easily find them.

View 8 Replies View Related

Debian :: Remove Duplicate "paragraphs" In Text File?

Aug 14, 2011

I have a text file with many pairs of number, one pair in each line. Each 25 of these pairs are a solution to a math problem I've been working on, and each solution is separated from another by a line with "**********".The problem is that there are duplicate solutions. In order to know exactly how many solutions I found, I have to delete the duplicate ones. How can I do that?Just to make things clear, here are the first three solutions:

1 1
3 2
5 3

[code]....

View 3 Replies View Related

Ubuntu :: Text Editor To Preserve Indentations On Wrapped Text?

Mar 21, 2010

I'm looking for a light-weight text editor for general-purpose composition that can preserve indentations on wrapped lines.

View 3 Replies View Related

Ubuntu :: Text Editor That Will Let Color Or Highlight Text On Demand?

May 11, 2010

Is there a simple text editor for Linux that will let you color or highlight text on demand? Something like gedit or leafpad with color? I know I can probably do this with vi or emacs, but I'm looking for something simple, need not be feature rich.

View 4 Replies View Related

Ubuntu :: Can't Remove Text From Menus

Jun 14, 2010

Prior to 10.04 there was a preference for menus which allowed you to remove or position the text in menus. I can't find that option in 10.04 nor can I find this parameter in the Configuration Editor. I wish to only have icons in the menu bars of applications.

View 3 Replies View Related

Ubuntu :: Remove Specified Line From Text?

Feb 12, 2011

I wish to move a specified line from a text file:

Quote:

ltoremove=5 #remove 5th line
i=1
while read line ; do

[code]....

how should this actually be done? is there a shorter faster way to do this?

View 3 Replies View Related







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