Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 9382

Manipulation or examining of text by programs, scripts, etc.

2
votes
In bash? #!/bin/bash while IFS= read line do echo -e "$line" done
answered Oct 22 '11 by rozcietrzewiacz
0
votes
A shorter version of enzotib's answer: [[ $(< "$file") != "ASDF" ]] && sed -i '/^ASDF$/d' "$file"
answered Aug 29 '11 by rozcietrzewiacz
1
vote
Since you say you do not have the convert tool, install ImageMagick (this is where convert comes from). You'll certainly have it in your distro's repositories. As you mentioned the tool, I assume you …
answered Aug 29 '11 by rozcietrzewiacz
13
votes
The crude way using grep would be something like grep -o "....yourtext...." /path/to/the/dump.sql The number of dots corresponds to the number of characters before/after the grepped text. The -o op …
answered Aug 24 '11 by rozcietrzewiacz
5
votes
Notice that you can also do what you attempt, that is iostat | grep "hdisk1 " | sed -e's/ */ /g' | cut -d" " -f 5 by iostat | while read disk tma kbps tps re wr; do [ "$disk" = "hdisk1" ] && ech …
answered Aug 19 '11 by rozcietrzewiacz
8
votes
Put it simple, you must read to more than one variable at a time for the IFS=<something> read ... construct to have a visible effect in your examples1. You miss the scope of read in the examples. The …
answered Aug 17 '11 by rozcietrzewiacz
25
votes
If you want not to get messed up but still do it using tail and head, there is a useful way of invoking tail using a line-count from the beginning, not the end: tail -n +4001 yourfile | head -4000 …
answered Oct 14 '11 by rozcietrzewiacz
2
votes
Just make use of grep -l together with -R! Here's a complete one-liner: grep -Rl "STRING" web/ | xargs sed -i "/STRING/d"
answered Jul 29 '11 by rozcietrzewiacz
12
votes
tail works with binary data just as well as with text. If you want to start at the very beginning of the file, you can use tail -c +1 -f.
answered Nov 28 '11 by rozcietrzewiacz
80
votes
The trap is that IFS=; while read.. sets the IFS for the whole shell environment outside the loop, whereas while IFS= read redefines it only for the read invocation (except in the Bourne shell) …
answered Aug 17 '11 by rozcietrzewiacz
10
votes
You can use grep for that grep -vh '^[[:space:]]*#' filename Since, as I presume, you are stripping comments from some file, you might also consider removing empty lines, which expands the above to …
answered Nov 28 '11 by rozcietrzewiacz