I know this question has already been asked, but no solution I found worked for me! I have a program that has this output:
COUNT|293|1|lps
I am interested in having a second field, but none of these attempts worked:
./spawn 1 | cut -d '|' -f2 ./spawn 1 | cut -d \| -f2 ./spawn 1 | awk -F "|" '{print $2}' ./spawn 1 | awk 'BEGIN{FS="|"} {print $2}' ./spawn 1 | sed 's/|/;/g' ./spawn 1 | sed 's/\|/;/g'
But the conclusion is always the same:
COUNT|293|1|lps
Is there an error somewhere in bash? I would be surprised the results would be the same on my Linux host and on my embedded device using the busybox! Any pointer is much appreciated!
EDIT My mistake, the output was in stderr ...._.
./spawn 1 2>&1 | cut -d '|' -f2 4615
Sorry for ennoying!
source share