Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-04-2007, 12:07 AM
|
#1
|
LQ Newbie
Registered: Jan 2007
Posts: 3
Rep:
|
how to delete different column in a file?
I am new to Linux. I have the foollowing information in a file and I have to delete the 2nd and third column. Please tell me how can I do it?
ft0.fm2.fail | 3Dh | ok | 29.2 | Predictive Failure Deasserted
ft1.fm0.fail | 3Eh | ok | 29.3 | Predictive Failure Deasserted
ft1.fm1.fail | 3Fh | ok | 29.4 | Predictive Failure Deasserted
ft1.fm2.fail | 40h | ok | 29.5 | Predictive Failure Deasserted
ft0.fm0.f0.speed | 41h | ok | 29.0 | 10000 RPM
ft0.fm1.f0.speed | 42h | ok | 29.1 | 9000 RPM
ft0.fm2.f0.speed | 43h | ok | 29.2 | 10000 RPM
ft1.fm0.f0.speed | 44h | ok | 29.3 | 11000 RPM
ft1.fm1.f0.speed | 45h | ok | 29.4 | 11000 RPM
ft1.fm2.f0.speed | 46h | ok | 29.5 | 10000 RPM
ft0.fm0.f1.speed | 47h | ok | 29.0 | 9000 RPM
thanks
-Tuku-
|
|
|
01-04-2007, 12:23 AM
|
#2
|
Senior Member
Registered: Jan 2006
Location: Charleston, SC, USA
Distribution: Debian, Gentoo, Ubuntu, RHEL
Posts: 1,148
Rep:
|
First, you posted in the wrong forum. You probably want ot go to a sub-forum called programming. Probably the easiest solution to your problem is to write a small bash script. Just google "bash script tutorial" and you'll get flooded.
|
|
|
01-04-2007, 01:49 AM
|
#3
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Odd forum to ask this question, indeed, but here's one
possible solution.
Code:
awk -F"|" '{print $1"|"$4"|"$5}' datafile
Cheers,
Tink
Last edited by Tinkster; 01-04-2007 at 01:51 AM.
|
|
|
01-04-2007, 09:53 AM
|
#4
|
root
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,609
|
I've moved your thread. Is there anything we could have done to make it clearer that the forum you originally posted this in was only for feedback about LQ itself? Your answer may help improve LQ.
--jeremy
|
|
|
All times are GMT -5. The time now is 06:22 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|