Top "Text-processing" questions

Mechanizing the creation or manipulation of electronic text.

How can I extract a predetermined range of lines from a text file on Unix?

I have a ~23000 line SQL dump containing several databases worth of data. I need to extract a certain section of …

unix command-line sed text-processing
Using multiple delimiters in awk

I have a file which contain following lines: /logs/tc0001/tomcat/tomcat7.1/conf/catalina.properties:app.env.server.name = demo.…

awk command-line text-processing
Add a prefix string to beginning of each line

I have a file as below: line1 line2 line3 And I want to get: prefixline1 prefixline2 prefixline3 I could write …

linux scripting text-processing
How to use sed to replace only the first occurrence in a file?

I would like to update a large number of C++ source files with an extra include directive before any existing #…

command-line sed text-processing
How to add a new line of text to an existing file in Java?

I would like to append a new line to an existing file without erasing the current information of that file. …

java file-io text-processing
Select random lines from a file

In a Bash script, I want to pick out N random lines from input file and output to another file. …

bash shell random text-processing
How to replace ${} placeholders in a text file?

I want to pipe the output of a "template" file into MySQL, the file having variables like ${dbName} interspersed. What …

bash command-line text-processing templating
How to convert all text to lowercase in Vim

How do you convert all text in Vim to lowercase? Is it even possible?

vim text-processing
Remove empty lines in a text file via grep

FILE: hello world foo bar How can I remove all the empty new lines in this FILE? Output of command: …

linux grep text-processing
Add text to file at certain line in Linux

I want to add a specific line, lets say avatar to the files that starts with MakeFile and avatar should …

linux text-processing