93,308 reputation
12106227
bio website
location European Union
age
visits member for 2 years, 3 months
seen 7 hours ago

8h
revised Remove everything that is not a 4 character number
you need another [^0-9] or it would match 1234 in x12345. The 0 is required in POSIX.
8h
revised Remove everything that is not a 4 character number
requirements clarified by the OP
8h
revised Remove everything that is not a 4 character number
clarification from comments.
10h
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.
11h
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
12h
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 `|`.
12h
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 "|"
12h
comment Remove everything that is not a 4 character number
That matches 1234 in 12345 though (and not 2345).
12h
comment Remove everything that is not a 4 character number
That matches 1234 in 12345 though (and not 2345).
12h
answered Horizontal scrolling in smaller increments with less -S
13h
answered How to pick out files in a folder in which the header contains specific text?
13h
awarded  Good Answer
13h
comment Remove everything that is not a 4 character number
What about in foo1234bar or 0x1234ff or 1.1234?
13h
answered Remove everything that is not a 4 character number
13h
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).
14h
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).
14h
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.
14h
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.
15h
revised How to count the number of interfaces in a bridge
added 520 characters in body
15h
answered How to count the number of interfaces in a bridge