Unix systems tend to favor text files, often consisting of one record per line. Most unix configuration files are text files. Unix systems come with many tools to manipulate such files. Most tools process the file in a stream: read a line, process it, emit the corresponding output; this makes it possible to chain scripts with pipes.
Use this tag when your question is about processing text files and you're not sure which tool to use. If your question is about a specific tool, use its tag.
Text processing utilities
- sed a simple line-by-line text processor, mostly used for regexp substitutions.
- awk a scripting language dedicated to text file processing
Text processing often involves combining many single-purpose tools, such as:
- cut select fields on each line
- diff compare two files line by line
- grep search a pattern in text files
- od display binary files in decimal, octal or hexadecimal
- sort sort lines or fields alphabetically
- split split a file into fixed-size pieces
- tail show the last few lines of a file;
tail -fkeeps the file open in case more data arrives - tee replicate the output of a command and send it to several destinations
For a list of many text utilities and more, check out busybox commands or GNU coreutils.
Other related tags
- shell text processing is usually performed by shell scripts that calls the tools described above
- pipe many tasks require chaining several tools
- coreutils the collection of GNU utilities (text processing and others), for regular Linux systems
- busybox a collection of utilities (text processing and others) for embedded Linux systems
- perl python ruby when the going gets tough, it's better to switch to more general languages