I want to
cat /proc/uptime into
cut -f1 in a Bash script.
cat /proc/uptime | cut -f1 cat /proc/uptime > cut -f1 cut -f1 < cat /proc/uptime
Do I need to use echo or something else to make this happen?
The default field delimiter for
cut is a tab. Since your file has a space instead, you need to specify the delimiter:
-d ' '
And you really don’t need to use
cat or a pipe at all. Just read the file directly.
cut -f 1 -d ' ' /proc/uptime
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.