Take the 2-minute tour ×

I wrote down a shell script using your'e assitence. now I need to make a similar batch.

how do I write this:

export COUNT=$(kwcheck list -pd .kwlp -s Analyze -Y | grep -o '[0-9]\+' | tail -1)

in batch?

This line runs a command that gives a lot of data, and one line before the last line says: "you have X lines". The grep command takes the number only, and puts it in the COUNT variable

share|improve this question
An unrelated question... Wouldn't it be better to use tail before grep? Now you grep all output, and then take the next to last line of the output from grep (and not the kwcheck program`). –  Joachim Pileborg Aug 16 '12 at 6:12
Thanks, but it wotks well, it's a really short script. the more important thing right now is the translation –  user1461638 Aug 16 '12 at 8:22

Your Answer



Browse other questions tagged or ask your own question.