I want to extract the first two columns as produced by by the command:
yum -e0 -d0 check-update
and not with the space truncated between the 1st and 2nd column.
Sorry for the late reply,was a bit busy with certain things...
No the commands didn't give me the expected results. I am using centos 5.3. I am using putty to login to the remote server.
Still i am not getting the first two columns in exactly the same format as given by the command: yum -e0 -d0 check-update
OK, I see, you would like to keep the exact same spacing that yum spits out. In that case we should cut of everything after the second field, e.g. like so:
yum -e0 -d0 check-update | sed 's/[\t ]*[^\t ]*$//'
tags when you post code sample or required output.
To keep the forums high quality for all users, please take the time to format your posts correctly.
[*]Use Code Tags when you post any code or data samples so others can easily read your code.
You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags and by hand.)
[*]Avoid adding color or different fonts and font size to your posts.
Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
[*]Be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
Thank You.
The UNIX and Linux Forums
Reply With Quote
---------- Post updated at 11:13 AM ---------- Previous update was at 11:11 AM ----------
# awk '{printf "%-40s%s\n",$1,$2}' file
dnsmasq.i386 2.45-1.1.el5_3
ecryptfs-utils.i386 75-5.el5
fetchmail.i386 6.3.6-1.1.el5_3.1
firefox.i386 3.0.14-1.el5.centos
gdm.i386 1:2.16.0-56.el5.centos
gnutls.i386 1.4.1-3.el5_3.5
lftp.i386 3.7.11-4.el5
mysql.i386 5.0.77-3.el5
mysql-devel.i386 5.0.77-3.el5
mysql-server.i386 5.0.77-3.el5
nfs-utils.i386 1:1.0.9-42.el5
nspr.i386 4.7.5-1.el5_4
nspr-devel.i386 4.7.5-1.el5_4
openssh.i386 4.3p2-36.el5
openssh-askpass.i386 4.3p2-36.el5
openssh-clients.i386 4.3p2-36.el5
openssh-server.i386 4.3p2-36.el5
openssl.i686 0.9.8e-12.el5
openssl-devel.i386 0.9.8e-12.el5
xulrunner.i386 1.9.0.14-1.el5_4