for instance,
in bash when i type ps -wef I will get:
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 20:06 ? 00:00:01 /sbin/init
root 2 0 0 20:06 ? 00:00:00 [kthreadd]
root 3 2 0 20:06 ? 00:00:00 [ksoftirqd/0]
root 6 2 0 20:06 ? 00:00:00 [migration/0]
root 7 2 0 20:06 ? 00:00:02 [watchdog/0]
root 8 2 0 20:06 ? 00:00:00 [cpuset]
root 9 2 0 20:06 ? 00:00:00 [khelper]
root 10 2 0 20:06 ? 00:00:00 [kdevtmpfs]
root 11 2 0 20:06 ? 00:00:00 [netns]
root 12 2 0 20:06 ? 00:00:00 [sync_supers]
root 13 2 0 20:06 ? 00:00:00 [bdi-default]
root 14 2 0 20:06 ? 00:00:00 [kintegrityd]
root 15 2 0 20:06 ? 00:00:00 [kblockd]
root 16 2 0 20:06 ? 00:00:00 [ata_sff]
root 17 2 0 20:06 ? 00:00:00 [khubd]
root 18 2 0 20:06 ? 00:00:00 [md]
root 21 2 0 20:06 ? 00:00:00 [khungtaskd]
and I know which column i want to keep, for example i want to keep the second column which is the PID column, the final result will be:
1 2 3 6 7 8 9 10 11 12 13 14 15 16 17 18 21
the first line of the original result of ps will be deleted.
How can I use sed or awk to get my final result?
Thank you.
I hope this helps.,