General :: Get Rid Of Surplus Comment Lines With Sed?

Feb 14, 2011

I have a large text file and I have some comment lines in it beginning with $.

Now here is the challenge there are some lines where there is actually a written comment after $ (with some blanks between)

Then there are lines with only $ on it - with maybe some trailing spaces.

I would like to delete these dummy lines...

Lets say from

$ This is valid comment
$
$
$

[Code]....

View 3 Replies


ADVERTISEMENT

General :: Find Pattern And Comment Out 2 Lines After It?

Oct 14, 2010

How do yo find a pattern with sed or awk and then:

- add a # at the beginning of the line containing it

- and add a # at the beginning of the following 2 lines, too?

Say, I want to comment out the line containing "which 0launch" and the two lines following it:

if [ -x "`which 0launch`" ]; then
exec 0launch http://rox.sourceforge.net/2005/interfaces/ROX-Filer -S
fi

Expected result:

#if [ -x "`which 0launch`" ]; then
# exec 0launch http://rox.sourceforge.net/2005/interfaces/ROX-Filer -S
#fi

I need this because I do not want to comment out every line containing "fi", just the "fi" of this specific if statement.

View 3 Replies View Related

General :: Comment On Partitioning Strategy?

Mar 7, 2011

I'm planning to partition a new hard drive to dual-boot Mint+Mepis. I've read partitioning tutorials and posts, and want to check my understanding--I'd appreciate input from an experienced person.For 500GB hard drive, dual-boot Mint+Mepis:

--Mint: / root partition for OS; /home partition for ease of upgrading
--Mepis: same as Mint
= four partitions

And:
/swap partition to be shared between Mint+Mepis
/shared partition for shared data
= two partitions

Total = six partitions

Since four primary partitions are allowed, I should use three primary partitions and one extended partition containing three logical partitions.Is that correct?If so, what should go where? I assume there's an optimal strategy--Should each /root of Mint+Mepis go in a primary? What should go in the other primary, and in the three logicals? Or maybe I don't need three primaries?--use two primaries and four logicals?

View 4 Replies View Related

General :: Delete All Lines Containing A String, Plus 4 Lines Below It?

Jan 26, 2010

I've come across an unusual requirement for a service in my Ubuntu system.Simply put, I need to find a way to search for all instances of a term in a file, delete lines containing containing that term, and delete four lines below each instance of that term. ither that, or copy the entirety of a file to a new file and skip over all lines containing the term plus four below it.This sounds kinda weird, I know. Without going too far into detail, I either have to change the logfile format for a server I'm running which is a huge pain in the butt, or I can just run a script to edit an HTML report generated from said logs. (Said report is really just for managers to peruse, and I like my log format, so I'm pursuing option 2.)

View 4 Replies View Related

Debian :: Possible Bug In Comment

Dec 17, 2010

Just upgraded from Lenny to squeeze, and noticed that the comment in /etc/fstab, and it says that I should use vol_id to find my UUID, but shouldn't it be blkid? My system can't find vol_id?

View 6 Replies View Related

Hardware :: Comment On WD HDD

Aug 18, 2010

Has any folk used following WD HD before?

WD Caviar Green
SATA Hard Drives
1 TB, SATA 3 Gb/s, 64 MB Cache WD Caviar Green 1 TB SATA Hard Drives ( WD10EARS )What will be your comment. I never used WD HD before only Seagate HD. I like this WD HD because it has 64MB cache. Its price is more or less the same as Seagate and other brand HDs of same storage capacity.

View 6 Replies View Related

OpenSUSE :: Web - Screen Loads And After Initial First Few Lines Breaks Up Into Multiple Repetitions Of Lines

Apr 22, 2011

I have been experiencing a problem where the screen loads and after initial first few lines breaks up into multiple repetitions of lines. Reloading helps but has to be repeated when pageing down. Mail is no problem; it is supplied by my network provider. OS is openSUSE 11.2 which I update when advised. Below is a sample from the error console:

[Code]...

View 1 Replies View Related

Ubuntu :: Wobbly Windows Lines - Get These Lines When Drag/move The Window Upwards

May 31, 2011

I've just installed Kubuntu 11.04, switched on wobbly windows effect. It runs very smooth on my Nvidia GeForce 7600 GS with dual screen twinview turned on. However, I get these lines when I drag/move the window upwards - see screenshot:

View 6 Replies View Related

Programming :: Remove Lines And Parts Of Lines From Python Strings?

Nov 24, 2009

How do you remove parts of strings using python? Such as, if I have something like:

Code:
erme1 sdifskenklsd
erme2 sdfjksliel

[code]....

View 3 Replies View Related

General :: Replace Several Lines In A File With Other Lines In Another File?

Oct 26, 2009

I have this massive table file with some data in it and I want to replace some lines that are wrong with the correct ones that are in another table file of the same format. The wrong lines are not all together in a block but randomly distributed so I need to make a loop checking if the line is in the other file and if it is, replace it. I want to try and do it with sed or awk but I don't really know how to....

View 12 Replies View Related

OpenSUSE Install :: Comment On Bad Translations

Nov 3, 2010

I've been using openSUSE for some time now 10.x to 11.3, there is always badly translated things. In this case the timezone shows "Ciudad de Mexico" as "Ciduad de Mjico"Just for the comment, other users could find more stuff in the subject

View 5 Replies View Related

Red Hat / Fedora :: Add A Comment To Specific Line With Sed?

Jul 15, 2010

how can i add a comment to specific line with sed?

View 2 Replies View Related

Programming :: Is There Pseudocode Comment Convention?

Nov 18, 2010

While writing pseudocode is there a convention for writing comments within the pseudocode?

View 4 Replies View Related

Fedora :: Is It Safe To Comment Out Old Entries In GRUB?

Aug 8, 2011

I recently installed F15 on my laptop. Earlier today I updated a little bit more than 500 different things, and then rebooted. Upon seeing the GRUB menu, I saw that one of the updates added a newer menu entry for Fedora- the newer one's version was a fraction higher than the older menu entry.Anyways, is it safe for me to comment out the old entry in /boot/grub/menu.lst?

View 6 Replies View Related

Ubuntu :: PDF Annotator - Can't Comment And Mail To Co Worker

Sep 15, 2010

Have spend I while searching the net for at PDF annotator for Linux, but can't seem to find any. Most of the forum and blog post I found on the subject suggested different programs, Common for these though, is that they don't do annotations in the pdf, but rather import the pdf as a background for writing on top and then saving your notes separately. This have to problems:

1. You can't comment a pdf and mail it to your co worker.
2. You can't switch between programs freely...

As far as I know the pdf format has capabilities for annotations/comments. So anybody know how to take advantage of this, for note taking? My use for this would mostly be notes on slides during lectures etc.

View 7 Replies View Related

Ubuntu :: Comment The Bold Line (env Command)?

Sep 13, 2010

I have this line in my in a .sh file:

Code:
#!/bin/bash
...

[code]....

View 12 Replies View Related

Debian :: Dist-Upgrades Halt With Comment Can't Respond To?

Jan 28, 2010

This n00b is having a weird situation during dist-upgrades that I've never seen before. It's puzzling my more-experienced pals in an irc channel, too.

Sometimes--not every time--while running a dist-upgrade outside of X on my Debian Testing machines, I get an informational text display (a comment box?) that always ends with the text "(END)". The display freezes there, and I am given no opportunity to respond and let the upgrade procedure continue.[URL]..

I've tried pressing escape, the space bar, enter, arrow-keys... nothing changes (I get system beeps with each keystroke). If I Cmd+C, I get a root prompt back, but any characters I type are not displayed as I type them. For example, I can type # "shutdown -r now", and the machine will shutdown --but the characters are not displayed as I type them.

If I immediately restart, go into a regular X session, and run synaptic, I get the same comment--but in a window with a "Close" button that I can click. The upgrade will then continue [URL].. This has happened on at least 3 different boxes, all running debian testing. Under gnome and xfce... Probably with 4 different packages in the last 3 weeks?

This morning it happened on a new debian testing install, and just now it happened -- with the identical package -- on an older debian testing install on a different box.[URl]..

View 3 Replies View Related

Ubuntu :: Photo Slideshow Application With Comment Ability

Aug 30, 2010

Well I use Shotwell Photo manager for all my photos and I love the app but I can't comment on the photo for a slideshow. So I want to put around 300 or so photos in a slideshow and put comments on them but I dont want to import each photo individualo to OO presenter.

View 1 Replies View Related

Programming :: Search For A Word In A File And Then Comment It Or Delete It?

Aug 9, 2009

I want to know that how can i search for a word in a file and then comment it or delete it. I know this command works.

sed 's/word/#word/'g inputfile > outputfile

But the lines in my input file are as under:

zone "abc.com" { ---- This line can be comment
type master; ----- This line repeat again and again in the file
file "abc.txt";
allow-query { any; }; -This line repeat again and again in the file
};

I want to know how can i comment a certain zone.

View 8 Replies View Related

SUSE / Novell :: Use The Usermod Command To Add A Comment To /etc/passwd?

Oct 3, 2010

I need to add a comment to /etc/passwd using usermod, but everytime I do it tells me that I can't modify a user in the LDAP database without DN. What is DN?

View 7 Replies View Related

Programming :: Insert A Comment In Html File Based On Its Contents?

Jun 10, 2010

I have multiple HTML files in a folder. there is a <h2> tag like this:

Code:

<h2>some text</h2>

in each file. I want to write a shell script/batch file to add this tag in <head> section of each file:

Code:

<!-- TITLE= "same text from h2 tag" -->

Note that <h2>some text</h2> in some files has 1 or more linebreaks and so I couldn't capture tag content using a simple grep or...
for example:

<h2>first part of text
second line of text</h2>

The line break shouldn't be shown in <!-- TITLE= "same text from h2 tag" -->. The script has to capture tag content & skip line breaks.

View 3 Replies View Related

CentOS 5 :: Change Or Add Text To The Login Page In Comment Line

Feb 16, 2010

I have installed the astercc box it is running by centos 5.2 and i want to add some text to the " login page " i dont know how its called but when i start the pc when everything is been loaded it ask for the user and password And in top of it i want add tekst there,

View 5 Replies View Related

CentOS 5 Networking :: IP Tables Comment Module Causes COMMIT Fail?

Feb 12, 2011

IP Tables Comment Module Causes COMMIT Fail

/etc/sysconfig/iptables:
*filter
:CHAIN_X - [0:0]

[code]....

View 10 Replies View Related

OpenSUSE Install :: OpenFATE - #310836: Add An Option In YaST To Comment Out An Entry

Nov 20, 2010

I agree that this is a problem in making every NTFS partition a boot selection option in your grub menu.lst file during the installation of openSUSE. Someone should consider asking help from please_try_again in the openSUSE forums on how to find a bootable Windows partition and add that fuction to the openSUSE installer. Here is a pointer to the findgrub article here.

Looking for Grub and Windows bootloader in all partitions.The basic situation is that there is normally is only ONE booting copy of Windows, so why would you create three or four menu entries due to the number of NTFS partitions found on a hard drive? Finally, just as indicated by Jean-Daniel Dodin, If one of those partitions in the restore partition and a user boots it, it could be all over for the user copy of Windows, for the openSUSE install and for ever getting this user to try openSUSE again.

View 9 Replies View Related

Ubuntu :: Document Management App - Record The Category - Bank Statement - Date - Comment

Dec 29, 2010

I'm trying to clear a bit of space in my overstuffed filing cabinet by scanning all my bank statements, credit card statements, insurance, important post etc. into my computer.

I've been looking for a very simple document management system, where I can record the category (bank statement etc.) date, comment, etc.

I don't want to make these accessible via the internet and I really don't want to hand them all to Mr. Google, via googledocs, because he already has enough info about me without reading my bank statements.

View 1 Replies View Related

General :: Awk Group 2 Lines ?

Jul 15, 2011

I have a file with n number of lines where every 2 lines are grouped.

So I want to print the items in a line and the next line in a single line.

For example:

I can print the line and the adjacent together and print the required items like this:

But that's not the order I want. How can I get it printed like below:

View 1 Replies View Related

General :: Why Does AWK Split Lines Into Two

Aug 5, 2010

when I run the following command:

awk -F, '{print $10 "," $5 "," $1 "," $3 "," $4 "}' myfile > tmpfile

tmpfile displays the lines but they are all cut off and placed on the line below at the same point.

View 1 Replies View Related

General :: Deleting Several Lines In Vim?

Mar 5, 2011

I've a big text, and I would like to delete several lines in vim. I was thinking in doing that with marks, but I can't do it. Below it's an example text and I want to delete from <FROM HERE> to <TO HERE>. How can I do that?
[Quote] .....

View 3 Replies View Related

General :: How To Use Find With Two Lines Together

Jan 19, 2010

I am trying to search for

Code:
<cats>
Sports
</cats>

how do i use the find command to search for <cats>Sports The problem here is that the word Sports is in the next line of <cats> so I cant use -

Code:
find /test/upload/ -type f -name "*.xml" -exec grep -l "<cats>Sports" {} ; -print
How do I put the next line string?

View 8 Replies View Related

General :: Get The Lines With Only Five Characters?

Nov 2, 2010

I have a file with a random word on each line (3k+ lines). How can I get the lines with only five characters? I tried using grep file | more, but it returns all the words (even those less than 5 characters).

Edit: I also tried grep '.{5}' file | more but it doesn't show anything. And grep '.{5}' file | more returns all lines with four or more characters (I'm really confused about why it's doing this).

View 4 Replies View Related







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