1
vote
1answer
19 views

Print every line but conditionally only fragments for some lines

I have a text file that looks like this: rno-miR-344-5p miRPlus_11239/mmu-miR-383/rno-miR-383 hsa-miR-301a/mmu-miR-301a/rno-miR-301a ...
0
votes
1answer
48 views

Need to iterate through a list of files and append text at the first line of the files in th list on a Linux CentOS system

I need to be able to append the text <?php to the beginning of php files in a list. Thank you in advanced for the help.
1
vote
1answer
189 views

create multiple files from single text file based on headings

I have what I think is a really simple problem to solve (preferably with OS X / *nix terminal tools rather than windows command line). I have a manuscript formatted in markdown with # (H1) denoting ...
11
votes
3answers
2k views

Substitution in text file **without** regular expressions

I need to substitute some text inside a text file with a replacement. Usually I would do something like sed -i 's/text/replacement/g' path/to/the/file The problem is that both text and replacement ...
0
votes
1answer
2k views

Sed error “sed: -e expression #1, char [#]: extra characters after command”

sed '/\r$/ {N s/\n//}' sed: -e expression #1, char 10: extra characters after command I want to understand what is wrong with my command line. When I can do the some of following in a script ...
1
vote
1answer
351 views

Removing the last tab of a line in a file

I have a text file which consists of tab delimted fields terminated with a CR/LF. Before the CR/LF an extra tab has been inserted effectively creating a blank field at the end of every line. I would ...
3
votes
2answers
953 views

Increment one value in a text line, using script

I have a text file as input. I need to filter that through some program, SED, AWK, whatever, where i need to increment a value in a particular line every time i run the script. What's the best way ...
3
votes
2answers
4k views

replace nth occurence of string in each line of a text file

I have large text files with space delimited strings (2-5). The strings can contain "'" or "-". I'd like to replace say the second space with a pipe. What's the best way to go? Using sed I was ...
1
vote
4answers
1k views

using sed to remove lines in a file

I have a file that looks something like this: Heading - - Completed foo - More information - Still more * Need to complete bar - Did baz (comment blah blah) *** Another - * Need to ...
1
vote
4answers
286 views

retrieving headers / comment blocks

I have a number of log files that look like this: /* header arbitrary number of lines */ blah blah blah blah Using simple Bash commands (preferably sed, not awk), how would I retrieve only the ...