General :: Sed: Perform Replacement Only On Even-numbered Lines?

Jul 20, 2010

I'm sure this is possible but I can't figure it out. I have a file formatted like this:

Code:
>SEQUENCE1
FGFD665:?@663:BBBBAA?A@<<4!1004699<7444399>???888455555?AAA?AABBB@@@<<<34
>SEQUENCE2
>&<4!1004699<7444399>???888455555?AAA?AABBB@@@<<<34BBB@@
>SEQUENCE3
???888455555?AAA?AABBB@@@<<<341004699<7444399>???888BBB@@

The odd-numbered lines containing >SEQUENCE# are the headers and the even-numbered lines containing a variety of characters represent DNA sequence read quality scores.

I want to replace all of the greater-than (">") symbols in the quality scores (even-numbered lines) with a "0" but I want to leave the greater-than symbols on the odd-numbered lines alone. I would just use sed -i '/^>/! s/>/0/g' $FileName but sometimes the quality scores begin with a ">" as well.

I'm sure there is a simple modification of a normal sed command with an "n" inserted somewhere but I can't figure it out.

View 3 Replies


ADVERTISEMENT

General :: Command To Swap Even And Odd Numbered Lines In A File

May 28, 2010

I'm looking for a command to swap the even/odd numbered lines in a file. Example input file:

Code:

1
2
3
4

[code]...

Example output file:

Code:

2
1
4
3

[code]....

I'm sure there's a way to do it with sed, awk, grep and the like but it's been many years since I've used these commands on a daily basis and I can't seem to figure out the correct syntax.

View 2 Replies View Related

General :: Cp 'limit' Numbered Backups?

Mar 17, 2011

I currently use cp to backup data. I prefer it over rsync. I use the -b switch to make a backup of data and recently found you can use --backup=t to create numbered backups.Using --backup=t means that I could end up having 100 versions of a file if I change it 100 times. With the -b switch I will only ever have 2 versions. Is it possible to limit the numbered backups to 5 for example? So I would only ever have 5 versions?

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

General :: Gui Replacement For Grub?

Aug 3, 2010

setting up a dual boot system and would like a gui replacement for grub

View 6 Replies View Related

Ubuntu :: Need To Correctly Sort Hex Numbered Files

Feb 5, 2011

I have some files, named E000.svg, E001.svg, E002.svg, ... E07D.svg, E07E.svg, E07F.svg . When I open them in Nautilus, and choose the option Sort Alphabetically, they are sorted:

E000.svg
E00A.svg
E00B.svg
E00C.svg
E00D.svg
E00E.svg
E00F.svg
E001.svg
E01A.svg
E01B.svg
and so on.

This is totally useless for me, so I searched for a solution in Google, and found lots of bug reports. It looks like it's a 'feature' for sorting 10 after 9; but clearly they have forgot that many people don't like or don't need that option. Thinking it was a Nautilus thing, I installed Thunar, but it has the exact useless algorithm. And then I installed PCManFM, but it's also the same. If I can install a file manager that correctly sorts my files? Or will I need to switch to Windows to have it fixed? (not joking here, Windows Explorer doesn't suffer from this feature).

View 9 Replies View Related

Ubuntu Installation :: Launch Bar Icons Numbered?

Feb 9, 2011

I have my 10.10 Unity completely installed, working just fine. I reboot and presto all of my launch bar icons have sequential numbers that weren't there before. Anyone know how to remove the numbers.

View 1 Replies View Related

General :: Recommendations For A Suitable Replacement?

Mar 21, 2011

I noticed over the weekend that there don't appear to be any new stories showing up at linuxtoday.com. Does anyone know what's up? Any recommendations for a suitable replacement?

View 5 Replies View Related

General :: Hardware Replacement Slackware

Jan 15, 2010

I intend to replace my hardware (except hard disks). Is it possible to avoid reinstalling the system? I guess it will not boot with new hardware configuration.I have 64bit Slackware 13.

View 6 Replies View Related

General :: Replacement For Clrscr() Function?

Jan 21, 2011

i have been using turbo C for a while to do programing . can u plz let me know the replacement for clrscr() function in linux

View 1 Replies View Related

Programming :: Show The Output Of These Fields In A Certain Way That Every Record Is Numbered?

Mar 25, 2010

i am reading a database flat file with the "awk" command which has 4 fields separated by colon ":" .I want to show the output of these fields in a certain way that every record is numbered e.g

1.some text
2.some text

Is there a way to do this?

View 14 Replies View Related

General :: Most Popular Replacement Distro For OLPC?

Apr 25, 2011

I want to get rid of OLPC XO-1's builtin distribution (mostly because it's impossibly slow to use for anything, even browser and pdf reader). What's the most popular replacement distro for this?

View 1 Replies View Related

Ubuntu Multimedia :: Join Ulitple .avi Files With A Numbered Extension?

Sep 19, 2010

This should be easy but despite all the hints and tricks I've read, I cannot make this work. I have 130+ files with the names filename.avi.001, filename.avi.002, filename.avi.003 all the way up to filname.avi.132. How do I join them? A simple cat command does not work, neither does avimerge or any other utility I can find. I'm guessing because the file extension is a number and not .avi. Is there and easy way to rename them all and then join them? I can't be the only one with this issue but I've scoured the forums and found nothing.

View 7 Replies View Related

General :: Sed Command Does Not Perform Substitution

Jul 22, 2010

I've been trying to use a find command with -exec to find the differences between identically-named files in different paths. My initial attempt was to do something like this:
Code: find trunk/ -type f -not -path '*.svn*' -exec diff '{}' `echo '{}' | sed 's/^trunk///'` ;

Unfortunately this does not work at all as expected (the diff ends up executing on the same file)! I have narrowed it down to the subshell (inside the ``) but beyond that I have no idea. For some reason the sed, though written correctly, does not perform the substitution. I've changed the diff to echo and played with the sed command and the only way I can get it to perform _any_ substitution is to use .* as the regex. Even s/.*trunk.*/SUB/ doesn't work. Any insight into the inner workings of -exec/subshells/pipes or some crap I'm missing? Don't worry about rewriting the command to make it work; I simply swapped the paths and got rid of the subshell nonsense and everything works fine.

View 4 Replies View Related

General :: How To Perform A Hardware Inventory

Mar 3, 2011

is there an easy way for me to get the hardware specs of a linux machine, such as number and type of processors, RAM, BIOS version, # of power supplies, etc from a command line?

I'm dealing with Dell servers, but even if i can just get number and type of processors and RAM config, that'd be great. I know how to easily do it in Windows, no clue on Linux.

View 6 Replies View Related

General :: Perform HDD Cloning / Mirroring?

May 10, 2011

Currently I backing up the MBR, the C and the other partitions to an external USB HDD and from there I restore them if needed. I use the SystemRescueCd and commands like dd if=/dev/sd* of=/mnt/PC_name/backupmbr.1 count=1 bs=512 and ntfsclone --save-image --output /mnt/PC_name/PC_name_c.img /dev/sd*1 etc. I want to clone the HDD the way, however, that I omit the external USB drive. I want to connect the new HDD to the PC and do the cloning directly from one disc to the other.

My questions are:

- Can you provide me with the exact command?
- Is that a difference if the disc is SATA or IDE?
- Can I copy the disc even if the old disc don't wan to boot?

The OS is Windows on the disc I want to clone.

View 14 Replies View Related

General :: Steps To Perform OS Patching?

Apr 10, 2011

I need to perform patching on some RHEL boxes.
This the first time i am gonna do this. Kindly advise, how and what are the steps i should take to perform the OS patching.

View 6 Replies View Related

General :: Replacement On More Than One Line In Text Files Using Shell

Nov 25, 2010

How can I replace one instance of a word in a text file with a piece of text that spreads several lines ? I know sed or awk is the way to go but don't know that how I can introduce new paragraphs using these tools

View 1 Replies View Related

General :: Sed And Back References Replacement Doesn't Work

May 16, 2011

usually I don't have any issue using regex usually, but today.... It just doesn't want to work. I've a text file (called "data") containing this:

[Code]....

View 2 Replies View Related

General :: Vim - String Replacement From Current Position To End Of File?

Jan 24, 2011

What is the vim command I have to use when I want to perform a text substitution not on the current line or on the whole document or on lines from number x to number y but just from the current cursor position down to the end (or up to the beginning) of the document?

View 1 Replies View Related

General :: Possible To Perform An Up-to-date Installation Of CentOS 5?

Feb 15, 2010

Can one perform an installation of CentOS 5 (5.4) so that the system is up-to-date at the time of the first boot (i.e. Anaconda will pull and install the 'latest' versions of the packages directly, and the user needn't run `yum update` | `yum upgrade` after the system has been installed)?

If this is doable at all, is it possible to accomplish without making use of a personally custom-crafted-and-hosted repository (i.e. can one of the official CentOS mirrors be used)?

Also, I'm not talking about creating an install DVD containing the latest versions of the packages, but rather, if the netinstall media can be used to perform this particular type of installation.

View 2 Replies View Related

General :: Perform A Safe Upgrade In Debian?

Mar 20, 2010

I am using debian 5.04 + LXDE. In the past, I sometime encounter problems such as the distro broken after performed a full apt dist-upgrade or upgrade. Now, I am more conservative, I am using apt safe-upgrade.

I want to know are there anyway to do a better safe upgrade for debian without breaking the distro?

View 2 Replies View Related

General :: Perform An E2fsck -y On Only Two Volumes At Restart?

Mar 10, 2011

I want to perform an e2fsck with the y switch (so I dont have to answer yes to every question) on two volumes on a server the next time I restart it. I don't want to do a shutdown -rF because 1) I dont want to check the other volumes and 2) it seems when I do that, the e2fsck doesn't keep restarting itself over and over to fix all the problems. Seems like it runs once, then if it fails it drops you to the repair console in single user mode. I'd rather just have it start the check that will keep repeating over and over right away, because I know it'll take more than one pass.

View 5 Replies View Related

General :: Perform Root Level Tasks While In GUI?

Oct 5, 2010

There must be a way to perform privileged tasks in the Gnome desktop (or actually Nautilus, I guess)...similar to using SUDO in a terminal window.

For example I want to change the rights to a file, but Nautilus tells me I can't because I'm not the owner.

View 8 Replies View Related

General :: My Ubuntu 10.04 Restarts As Perform A Certain Task

Aug 24, 2010

Am have a little problem with my ubuntu 10.04 which restarts as i do some task for example..as i am copying...playing music..and any operation task.

View 1 Replies View Related

General :: Perform A Remote Network Boot (F12) In SLES?

Jan 11, 2010

Anyone know how to remotely boot a server so that a network boot (F12) automatically starts? For example, in Solaris, I can type "reboot -- net -s" (hope i remembered the syntax - been a while! )to reboot my server and begin a network installation without having to be at the console. I am looking for the same in SLES.

View 1 Replies View Related

General :: Perform Double Click With Single Stroke?

Jul 19, 2010

I am arthritic and I have considerable difficulty with a double click. I also have difficulty when using a mouse of moving the mouse as I select something (click the button) from whatever window I am working with and thereby selecting the wrong thing. To compensate for this difficulty, I use a Logitech trackball and program the center button to perform a double click with one stroke. I am currently struggling with Linux Mint 9 in my search for a Windows alternative. Is there any way to program my center button (scroll wheel) to perform a double click in this or any other Linux version? Alternatively, is there any way to program a keyboard key to perform a double mouse click with a single stroke? I do not want any multiple key combinations for this operation, I want something that works with a single click of one button.

View 4 Replies View Related

General :: Create A Cron File That Will Regularly Perform?

Jul 30, 2011

Will this:

* * 1 1-12 * #dump -0uf /dev/st0/
* * * * 0 #dump -2uf /dev/st0/
* * 2-31 * 1-6 #dump -5uf /dev/st0/

answer this question?How to create a cron file that will regularly perform the following backups:a. Performs a level 0 backup once per monthb.Performs a level 2 dump one day per weekc.Performs a level 5 dump every day that neither a level 0 nor a level 2 dump is performed. If not, I'm I close? This is homework, so I don't want a direct answer

View 14 Replies View Related

General :: Perform Some Tasks When New File Is Added In Folder

Feb 21, 2011

I have a folder named "logs" which contains log files. I would like to have a bash script or a cron job or something like this which will check the folder continuousy and perform some tasks (for example echo "New file is created") every time a new file with pattern like "Screen.log.***" is created in the folder "logs"
Is it possible in Linux?

View 14 Replies View Related

General :: Partitioning / Perform Bad Blocks Scan On Root Partition

Nov 28, 2010

My root partition is formatted as ext3 and I would like to perform a bad blocks scan on it. Normally e2fsck -c -c does this, but you can not run it on a mounted partition. I know it is possible to force a fsck to run at boot by creating the file /forcefsck but is it possible to specify that it should also check for bad blocks? If not, what is the recommended way to check for bad blocks on the root partition? I would like to avoid having to create a rescue disk and boot off of it.

View 2 Replies View Related







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