ProgrammingThis 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.
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.
another method is to use the 'cut' and 'paste' commands
'cut -f2 fileName' will cut the 'Age' column; the second field of your tab-delimited file 'fileName'.
'cut -f1 fileName' will cut the 'Name' column; the second field of your tab-delimited file 'fileName'.
you could save the output of these commands to a file, ie 'age' and 'name', then run 'paste age name' and it will print the original file, with the columns switched. again, just save the output of that paste command to a file and itll be saved... and delete the temoprary files created with the 2 cut commands.
Thank you very very much,
I will learn more about "awk".
that's powerful
You're welcome If you're going to be doing a lot of text manipulation, I recommend O'Reilly's "sed & awk" (http://www.amazon.com/gp/product/156...lance&n=283155). I'd also recommend having a look at perl, but that's a personal bias of mine
another method is to use the 'cut' and 'paste' commands
'cut -f2 fileName' will cut the 'Age' column; the second field of your tab-delimited file 'fileName'.
'cut -f1 fileName' will cut the 'Name' column; the second field of your tab-delimited file 'fileName'.
you could save the output of these commands to a file, ie 'age' and 'name', then run 'paste age name' and it will print the original file, with the columns switched. again, just save the output of that paste command to a file and itll be saved... and delete the temoprary files created with the 2 cut commands.
I am a beginner of linux and just now enter a company about linux.
I graduated from university only just , so i have more to learn and have a lot of things to ask, i will disturb you again, hehe.
Basically, it's a complete programmable tool based on the idea of pattern-recognition. So you can search for various patterns (any one of several), as well as other, more-sophisticated conditions. And you can then break-up the resulting strings pretty much any way you like.
One of the most useful things I've done with it is to extract output from a mainframe printout. The mainframe could spit out the "printout" to a file which we could then download. And AWK could do the rest, even though the printout was anything but regular. There was a commercial product called "cambio" which did much the same thing, with a fancy GUI.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.