93,771 reputation
12106229
bio website
location European Union
age
visits member for 2 years, 3 months
seen 11 hours ago

2d
revised Remove everything that is not a 4 character number
clarification from comments.
2d
comment Remove everything that is not a 4 character number
See perldoc perlop about <>. for file, it's OK, for *, it's not as you've got an issue if there's a file called rm -rf "$HOME"| for instance in your current directory, as I've just found out. -T avoids the damage, but it not the solution. I'm starting to review all my perl answers to see where that applies and give warnings there. Serious blow to my confidence in perl.
2d
comment How do I put a time stamp with: wget --output-file=[FILENAME] [URL]
wget -o "camera_3$(date +%F_%T).jpg" [IP]/image.jpg
2d
revised How to pick out files in a folder in which the header contains specific text?
typo. Adding `-T` in case there's a file name ending in `|`.
2d
revised Single command taking two strings to extract string between them, like 'tr' (without expressions)
`-T` in case there are files with names ending in "|"
2d
comment Remove everything that is not a 4 character number
That matches 1234 in 12345 though (and not 2345).
2d
comment Remove everything that is not a 4 character number
That matches 1234 in 12345 though (and not 2345).
2d
answered Horizontal scrolling in smaller increments with less -S
2d
answered How to pick out files in a folder in which the header contains specific text?
2d
awarded  Good Answer
2d
comment Remove everything that is not a 4 character number
What about in foo1234bar or 0x1234ff or 1.1234?
2d
answered Remove everything that is not a 4 character number
2d
comment How to pick out files in a folder in which the header contains specific text?
Indeed. While nextfile was introduced by GNU awk, Brian Kernighan (the k in awk) added it in his implementation in 1996, and that eventually made its way to the BSD awks. Which means nextfile is more widely available than I initially thought (still not POSIX or available in many commercial Unices though).
2d
comment Need a shell script to check when a process start and when its ends?
What are P1 and P2? Process ids? Command names? Paths to some executables? In which case please define P1 starts. A process starts when it's being forked from its parent, not when it executes a file (a process may execute several files in its lifetime).
2d
comment How to pick out files in a folder in which the header contains specific text?
nextfile requires GNU awk or recent versions of mawk.
2d
comment How to pick out files in a folder in which the header contains specific text?
You've got your logic backward. You're only checking for FNR > 5 in lines that match the pattern.
2d
revised How to count the number of interfaces in a bridge
added 520 characters in body
2d
answered How to count the number of interfaces in a bridge
2d
answered grep words around a token
2d
revised grep words around a token
PCRE, not perl, GNU grep only. Good habit to use `'` instead of `"` for anything with backslashes (also for compatibility with `rc`). Typos.