New answers tagged

10 votes
Accepted

Is sed allowed to create a file if w command or flag is never executed?

The GNU implementation of sed follows the POSIX specification to the letter with regards to the handling of the w command and the w flag of the s command. The following is from the extended ...
user avatar
  • 276k
1 vote

Is is safe to snprintf with output to NULL and size 0?

POSIX Programmer's manual explicitly states that: The snprintf() function shall be equivalent to sprintf(), with the addition of the n argument which states the size of the buffer referred to by ...
user avatar
  • 800
2 votes

Why is `-W` reserved for vendor extensions?

v would normally be user for version or verbose, you cannot overload the switch. Bear in mind, this would be from a time when AT&T/BSD were the only versions out there and before ...
user avatar
  • 1,633
0 votes
Accepted

Read from external file, skip lines after a match, print and exit

You could do something like: #! /usr/bin/awk -f BEGIN { ARGC = 1 while ((getline file < "awk.data") > 0) ARGV[ARGC++] = file "date +%Y-%m-%d" | getline date } FNR ==...
user avatar

Top 50 recent answers are included