C
Caj Zell
Quite often a colleague asks me if I can help him traverse a file
resulting from debug output and pick out numeric values from some
pattern, comma-separated. For example, he may be interested in the
variable var1 and I tell him to do a little something like this:
perl -n -e 'if(/var1 = (\d+)/){print $1.",\n"};' debug.txt > out.txt
and pick out the last comma.
He's quite allright by this, but I wondered if there is any easy way to
avoid that last comma?
resulting from debug output and pick out numeric values from some
pattern, comma-separated. For example, he may be interested in the
variable var1 and I tell him to do a little something like this:
perl -n -e 'if(/var1 = (\d+)/){print $1.",\n"};' debug.txt > out.txt
and pick out the last comma.
He's quite allright by this, but I wondered if there is any easy way to
avoid that last comma?