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


ADVERTISEMENT

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

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

Programming :: Copy And Replacing Specific Line From File1 To File2 Line By Line

Mar 22, 2011

I have two files, file1.traj and file2.traj. Both these files contain identical data and the data are arranged in same format in them. The first line of both files is a comment.

At line 7843 of both files there is a cartesian coordinate X, Y and Z ( three digits ). And at line 15685 there is another three digits. The number of lines in between two cartesian coordinates are 7841. And there are few hundreds of thousands of lines in a file.

What I need to do is copy the X Y Z coordinate (three digits) from file1.traj at line 7843 and paste into file2.traj at the same line number as in file1.traj. The next line will be 15685 from file1.traj and replace at line 15685 at file2.traj. And I dont want other lines (data) in file2.traj get altered. This sequence shall be going on until the end of the file. Means copy and substitude the selected lines from file1.traj into file2.traj.

I tried to use paste command but I cant do for specified line alone.

Here i showed the data format in the file. I used the line number for clarity purpose.

Code:

View 10 Replies View Related

Red Hat / Fedora :: How To Cat From A Specific Line Onwards

Jul 22, 2010

I have a file which is having 10000+ lines. I want to view the file from 500th line onwards. How will i do that.

View 1 Replies View Related

Programming :: Replace Specific Character After Specific Line By Awk?

Jul 19, 2010

I want to replace specific character in a file after every specific line. example as follows.

O 000000000000000000
A 111111111111111111
C 222222222222222222

[code]...

View 2 Replies View Related

General :: How To Delete A Line At Specific Line Number

Jun 15, 2010

I m writing a script to delete a line at particular location.

But i m unable to use variable for specifying line number.

For example.

Code:

works fine and deletes 7th line from my file

But

Code:

gives following error.

Code:

View 7 Replies View Related

Programming :: Text On A Specific Line At The End Of A Line?

Jul 26, 2010

I'm trying to add text to a file for a specific group of users, I'll need to do examples as I can't think of an easy way of explaining, my file is like this:

Code:

users{
user1
user2

[code]....

At the present my code lists all the available groups, how would I add a user to a specified group? (e.g add "members user3") to the end of group 1 for example. So the code ends up like this

Code:

members user2,user3

View 14 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

Programming :: Sed Append To End Of A Specific Line?

Jan 29, 2011

What I am trying to achive is the editing of /etc/ssh/sshd_config I have the line

Code: AllowUsers usera userb

And I want to be able to append to the end of this line from a bash script.I have muddled together from other sites and got the following:-

Code: sed -e "s/^AllowUsers/� userc/" -i /etc/ssh/sshd_config

But this appears to add userc directly after AllowUsers and not after userb

View 2 Replies View Related

General :: How To Enter Value On A Specific Line

Feb 18, 2011

I am starting to learn shell programming, but I couldn't accomplish a simple thing that can be done with sed, awk.Its simple, I am dynamically getting an IP number, and a rule name, that I need to save them on a single file on a specific line number.I found how to enter a value on a specific line, but couldn't understand how to enter the second value.

View 3 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

Programming :: Replacing Set Of Characters In A Specific Line Using Sed Or Awk?

Dec 29, 2010

I would like to replace 'xxxx' with 'yyyy' which is in a file xyz.csproj not sure of what 'xxxx' is, it can be 3055, 4056, 7089 etc. I know it always appears at line # 5 and at character 50.

<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />

[code]....

View 14 Replies View Related

General :: Showing The Line Count Of A Specific File

Mar 30, 2011

Is this the correct way to show the line count of a specific file?

cat file | grep * -c

View 3 Replies View Related

Programming :: Append Variable String In A Specific Line?

Jun 8, 2010

I want to append a variable string to the end of a specific line. not like append the same string to each line. like in my file i have 4 columns, i want to add a string in 5th column in some fixed row.

View 4 Replies View Related

Programming :: Print Images From Command Line At A Specific Size

Jan 7, 2010

I have a requirement to print images (two to be precise) from the command line of a given size and without losing too much quality.

So, I may have two images, a.jpg and b.jpg which may be 4x4" and 6x4" respectively (the sizes may vary). I need to be able to print both these on a single sheet of paper (one under the other) at a given size for each - so a may be 2x2" and b may be 3x2" - the aspect ratio will always be maintained (or as near as possible!)

I am currently doing this a very messy way (because I don't know any other way!!) - basically I am converting the picture to a given size using a set density using convert and then concatenating the two using montage.

Here is part of my script:

Code:

Don't worry too much about the case statement at the end - that is just to be able to select to print either A, B or A and B.

The issue with this is that is doesn't work great if the aspect ratio is not maintained perfectly and also, it loses quite a lot of quality on the print.

I have a very old windows app which I wrote years back in VB (o dear! ) which does the same thing and the quality is fine (I am running it through wine). I want it to be command line though because I want to run it as part of other scripts etc.

View 4 Replies View Related

General :: Bash Script To Parse A File To Get A Set Of Line Between A Specific Characters?

Dec 23, 2010

I have a log file that contains information like this:

----------------------------
r11141 | prasath-palani | 2010-12-23 16:21:24 +0530 (Thu, 23 Dec 2010) | 1 line
Changed paths:
M /projects/
M /projects/

[code]....

what i need is, i need to copy the data given between the "---" to seperate files, for, e.g. the first set of data between the "---" should be in one file and another set of data in another file.

View 5 Replies View Related

General :: Removing A Line From File Which Is Having Specific Pattern Using Shell Script?

Mar 20, 2011

I'm new to the shell scripting. can any one help in creating shell script for matching the content of the specific variable with file. it should remove that line from the file if line is containing same value as variable and keep the other content as it is.i used grep -v for accomplishing the same. But grep will remove the pattern which is similar.For eg. Assume file "test" contain datas :aaffif i used grep -v command for the pattern "a" to this file this will remove content "aa" from the file. I want the pattern only "a" should remove from the file, if it is existing. otherwise it should throw alert content not exists.

View 5 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

Ubuntu :: Command Line (write A Short Script That Will Compress A Specific Folder) - 7zip

Oct 6, 2010

i need to write a short script that will compress a specific folder that`s on the Desktop (and all it`s content) and also will encrypt it with a password that is inside the script --->meaning it wont ask for a password+verification when compressing+encrypting

View 1 Replies View Related

General :: Command Line To Check For A Specific Email - By Subject - On An SSL Secured IMAP Server?

Feb 1, 2011

Anyone know a simple command line to check for a specific email - by subject - on an SSL secured IMAP server?

View 2 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

General :: Ubuntu - Package For Specific "command History" On Terminal Line?

Sep 19, 2011

Is there a package I can download for Ubuntu that would allow me to type in,for example, cd [tab key] and then it would go through the recent cd commands I've typed in?

View 2 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

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 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

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

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

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







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