01-03-2011
sed command to remove characters help!
I am trying to analyse a large file of sequencing data, example of first 10 lines below,
@HWUSI-EAS656_0044_FC:7:1:2447:1039#GCAATT/1
GNCTATGGCTTGCCGGGCTCAGGGAAGACAATCATAGCCATGAAAATCATGGAAAAGATCAGAAAAACATTTCAA
+HWUSI-EAS656_0044_FC:7:1:2447:1039#GCAATT/1
VBVZVSVZZ[aaW^^aaZ\WdacdaWXYK\SEFZFLTMHSZ^]^YYFHRSacWWcBBBBBBBBBBBBBBBBBBBB
@HWUSI-EAS656_0044_FC:7:1:2632:1042#ATAGTA/1
TNGTACATCTAAAAGCTCTAGAAAAAAAGGAAGCAAATTCACCCAAGAGGAGTAGATGGCAGGAAATAATCAAAC
+HWUSI-EAS656_0044_FC:7:1:2632:1042#ATAGTA/1
NBVWP]Y_]`dbacfggggegegggg``ecaacffcfffcdffff^ffccdfacf^^cac\dadaffcccff\da
@HWUSI-EAS656_0044_FC:7:1:2977:1039#ACCACT/1
ANGTAGCCATCTTTTTACTTTTTAATATGTGGCAGGATATCATTAAGTTGCCTGGGCTAAGGGCTGAGAGGATGA
In order to run the data through the barcoding file I need to remove the letters between characters including # until the /1
I have tried using
sed 's/#*\/1$/\/1/g' <./s_7_sequence.txt >./s_7.txt
to save the data as a new file called s_7.txt without the #***** but whenever I run this it runs but the new file looks exactly the same as the old. I have tried running sed to remove anything to check I'm not being completely useless and have had success with
sed 's/#G//g' <input >output
and this works fine but
obviously only removes the # and the first letter from the lines with #G.
I would appreciate any help at all to correct my sed command, I have now tried as many variations as I can understand but am a complete newby at this.
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
sed 's/^..//' file1.txt > file2.txt
this will remove the first two characters of each line of a text file, what sed command will remove the last two characters? This is a similar post to my other....sry if I'm being lazy....
I need a file like this (same as last post)
>cat file1.txt
10081551... (1 Reply)
Discussion started by: ajp7701
1 Replies
2. Shell Programming and Scripting
what is the sed command to remove the first two characters of every line of a text file?
each line of the text file has the same amount of characters, and they are ALL NUMERIC. there are hundreds of lines though.
for example,
>cat file1.txt
10081551
10081599
10082234
10082259
20081134... (20 Replies)
Discussion started by: ajp7701
20 Replies
3. Shell Programming and Scripting
Hi all,
I have this basic script to remove, in this case 9 characters from the end of a file name. This is what I have so far,
for file in *.mov
do
newname=`echo $file | sed 's/\(.*\)........./\1/' `
mv "$file" "$newname"
done
The problem is that it removes the file extension as well.... (2 Replies)
Discussion started by: Monkey Dean
2 Replies
4. Shell Programming and Scripting
I have the following line:
4/23/2010 0:00:38.000: Copying $$3MSYDDC02$I would like to use sed (or similiar) to remove everthing between and including $ that appears in the line so it ends up like this.
4/23/2010 0:00:38.000: Copying 3MSYDDC02I have been trying these but i'm really just... (5 Replies)
Discussion started by: jelloir
5 Replies
5. Shell Programming and Scripting
Here is my problem.
I have a list of phone numbers that I want to use only the last 4 digits as PINs for something I am working on. I have all the numbers in a file but now I want to be removed all items EXCEPT the last 4 digits.
I have seen sed commands and some grep commands but I am... (10 Replies)
Discussion started by: Sucio
10 Replies
6. Shell Programming and Scripting
Hi All,
I am new to Unix and trying to run some scripting on a linux box. I am trying to remove the non alphanumeric characters and alpha characters from the following line.
<measResults>883250 869.898 86432.4 809875.22 804609 60023 59715 </measResults>
Desired output is:
883250... (6 Replies)
Discussion started by: jackma
6 Replies
7. Shell Programming and Scripting
Hi,
I have a input of the form:
..., word1, word2, word3...
I want out put of the form
word1, word2, word3
I tried echo '..., word1, word2, word3...' | tr -d '...,'
but that takes out the commas in the middle too so I get
word1 word2 word3
but I want the commas in the middle.
... (3 Replies)
Discussion started by: forumbaba
3 Replies
8. Shell Programming and Scripting
Hi,
I am new to Sed and would like to know if it is possible to remove the characters .
I have a couple of files with a keyword and would like to remove the substring.
I am Using sed s/// but Its not working
Thanks for your Support
Andrew Borg (2 Replies)
Discussion started by: andrewborg
2 Replies
9. Shell Programming and Scripting
Hi,
I have a file with this line, it's always in the first line:
I want to remove these special characters: ´╗┐
file1
´╗┐\\bar\c$\test2\;3.348.118 Bytes;160 ;3
\\bar\c$\test\;35 Bytes;2 ;1
I want the same file to be only
\\bar\c$\test2\;3.348.118 Bytes;160 ;3
\\bar\c$\test\;35... (4 Replies)
Discussion started by: nakaedu
4 Replies
10. Shell Programming and Scripting
Hello!
I know that this expression gets rid of non-alphanumeric characters:
sed 's///g'
and I understand that it is replacing them with nothing - hence the '//'-, but I don't understand how it's doing it.
It seems it's finding strings that begin with alphanumeric and replacing them with... (2 Replies)
Discussion started by: bgnersoon2be#1
2 Replies
LEARN ABOUT OSX
bitesize.d
bitesize.d(1m) USER COMMANDS bitesize.d(1m)
NAME
bitesize.d - analyse disk I/O size by process. Uses DTrace.
SYNOPSIS
bitesize.d
DESCRIPTION
This produces a report for the size of disk events caused by processes. These are the disk events sent by the block I/O driver.
If applications must use the disks, we generally prefer they do so sequentially with large I/O sizes, or larger "bites".
Since this uses DTrace, only users with root privileges can run this command.
EXAMPLES
Sample until Ctrl-C is hit then print report,
# bitesize.d
FIELDS
PID process ID
CMD command and argument list
value size in bytes
count number of I/O operations
NOTES
The application may be requesting smaller sized operations, which are being rounded up to the nearest sector size or UFS block size.
To analyse what the application is requesting, DTraceToolkit programs such as Proc/fddist may help.
DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver-
bose descriptions explaining the output.
EXIT
bitesize.d will sample until Ctrl-C is hit.
AUTHOR
Brendan Gregg [Sydney, Australia]
SEE ALSO
iosnoop(1M), seeksize(1M), dtrace(1M)
version 1.00 Jun 15, 2005 bitesize.d(1m)