Tagged Questions
1
vote
1answer
59 views
Parsing the headers of sequence file
I have a multiple sequence file as
>abc|d017961
sequence1......
>cdf|rhtdm9
sequence2......
>ijm|smthr12
sequence3......
>abc|d011wejr
sequence4......
>stg|eethwe77
sequence5......
...
1
vote
3answers
98 views
How to convert from one date format to other format?
I have one problem with my date format. I want to change from one format to the other and vice versa. My date formats are
Format 1
YYYY-MM-DD
Format 2
MM/DD/YYYY
I want to change format 1 to ...
1
vote
1answer
36 views
how to clean free row/column spaces after the row of your data
I have a problem in cleaning my file where there are unnecessary free spaces below my last data row. This is created when I am copying and pasting my data from excel to text. I want my text file to ...
1
vote
1answer
34 views
How do I modify this Perl solution so that it will substitute embedded double quotes with single quotes?
Previously in this question: "string having doublequotes in between apart from the enclosing quotes" @BernieReiter asked a follow-up question where he wanted to take CSV entries such as the following:
...
2
votes
6answers
305 views
Repeat each line multiple times
Would like to have each line in a file repeated a fixed number of times.
e.g. have each line repeated four times:
a
b
c
becomes:
a
a
a
a
b
b
b
b
c
c
c
c
I've done some searching, and there are ...
2
votes
3answers
142 views
I want to find duplicates in a file and add a character to the end of the line on the 1st match
I am trying to find duplicates in a file and once a match is found mark the 1st match with a character or word on the end of the line.
eg my file (test.html) contains the following entries
host= ...
3
votes
3answers
107 views
sed + how to remove character/s that start or ended on each number
How do I remove the . character(s) that start in the beginning of each number or end on each number?
Remark – perl one liner also good alternative for sed.
Example input:
.23.12.44.5.
.233.3.3.3
...
0
votes
1answer
74 views
read line by line and take a string in line and assign that string to the subsequent line using perl [duplicate]
Data file is fixed length file, and I want to read file line by line and take a string from the current line, and then append that string to the subsequent line and write into another file.
For ...
-4
votes
1answer
78 views
How to transform two delimited ASCII files
These are 2 common delimited, text file transformation problems I'd like to find scripts to do (I dont know if awk or perl is best for these tasks).
csh is the default shell on my Solaris10 unix ...
2
votes
5answers
1k views
How can I split a text file into multiple text files using Perl?
I have a file ABC_TabDelim.txt that contains the following:
00:00:00:00 00:00:05:00 01SC_001.jpg
00:00:14:29 00:00:19:29 01SC_002.jpg
00:01:07:20 00:01:12:20 01SC_003.jpg
00:00:00:00 00:00:03:25 ...
5
votes
2answers
629 views
Replacing missing value blank space with zero
I have input.txt tab-delimited text file around 30K lines, I would like to check each row (s1..s30K lines) for missing value (i.e blank space) and fill the missing value with zero value.See out.txt
...
2
votes
3answers
2k views
Extracting column from comma separated text
I have a long comma-separated delimited file with 20K lines. Here's a sample:
"","id","number1","number2","number3","number4","number5","number6","number7"
...
0
votes
1answer
88 views
How to get rows between lines?
I have a perl oneliner:
echo -e 'sla\ndfjAAAAk\nsaljdfla\nsjdfBBBBsadf\njasdf' | perl -E 'my $_ = do { local $/; <> }; say join qq!\n!, m!\QAAAA\E\K(.*?)(?=\QBBBB\E)!gs'
k
saljdfla
sjdf
it ...
4
votes
6answers
270 views
What is the easiest way to check if column A and B values goes both ways with AWK? [closed]
What is the easiest way to check if column A and B values goes both ways?
Output to check:
Mike John
John Mike
Pamela Barbara
Barbara Pamela
Mike Paul
Roger Paul
Desired output
Mike <-> ...
3
votes
2answers
111 views
Column mismatch and substituting
input.txt (tab-delimted)
TTTTOTTT00000000008 RTTTT899 5.00E-28
TTTTOTTT00000000046 RTTTWRR 3.00E-31
TTTTOTTT00000000051 2.00E-11
TTTTOTTT00000000051 7.00E-12
TTTTOTTT00000000054 ...
2
votes
1answer
201 views
text processing-perl
I am a biologist. I would like help of computer experts to help in text file editing.
Here is what the input file looks like:
##dsfsd2
##sdf-sdf sasg 5.6.3
gi34_ex Gen CDS 161 317 . ...
2
votes
2answers
712 views
How to do a regex search in a UTF-16LE file while in a UTF-8 locale?
EDIT: Due to a comment Warren Young made, it made me realize that I was not clear on one quite relevant point. My search string is already in UTF-16LE order (not in Unicode Codepoint order, which is ...
8
votes
6answers
953 views
Delete lines beginning with #
How do I delete lines beginning with a #, given that there can be whitespace on the left and right of the #?
# Master socket provides access to userdb information. It's typically
2
votes
1answer
377 views
How to insert a first column to many files + how to convert unix time to normal time
There are many-many files in a directory that has e.x.: the following content:
INPUT:
root 1324711901
sshd 1272725792
And I'm searching for a solution how to convert the content of the ...
4
votes
4answers
713 views
How can I remove a specific string from a file only if there are other lines in the file?
How can I remove a specific string from a file ONLY if there are other lines in the file?
For example, don't touch this file:
cat file.txt
ASDF
but remove "ASDF" from this file:
cat file.txt
ASDF
...
1
vote
1answer
417 views
How to convert <a href=“http://xy.com”>XY</a> to [http://xy.com XY]?
Just for editing Wiki's..
So i have this input [from a larget text]:
TEXT TEXT BLA-BLA RANDOMSTRINGS BLA-BLA
TEXT TEXT BLA-BLA RANDOMSTRINGS BLA-BLA
TEXT TEXT <a ...
3
votes
4answers
800 views
Replacing text from a list of replacements. Added complication: backslashes
I have a file A that contains pairs of strings, one per line:
\old1 \new1
\old2 \new2
.....
I would like to iterate over file A, and for each line perform the replacement (e.g. "\old1 -> \new1") ...
7
votes
6answers
1k views
Is there any alternative to grep's -A -B -C switches (to print few lines before and after )?
grep -A 2 -B 3
prints 2 lines after the grep string and prints 3 lines before.
grep -C 3
prints 3 Lines before and 3 lines after
Unfortunately, the grep I'm using does not support these ...
7
votes
1answer
282 views
Is there a way to make perl -i not clobber symlinks?
A friend of mine points out that if you do:
perl -pi.bak -e 's/foo/bar/' somefile
when "somefile" is actually a symlink, perl does just what the docs say it will do:
It does this by renaming ...