LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 12-28-2012, 03:39 AM   #1
yaswanth4b7
LQ Newbie
 
Registered: Aug 2012
Posts: 5

Rep: Reputation: Disabled
command


Hi, i am having a file. data contained in columns so i want to see only 4 th column is there any command to check it?
 
Old 12-28-2012, 03:42 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by yaswanth4b7 View Post
Hi, i am having a file. data contained in columns so i want to see only 4 th column is there any command to check it?
You can use awk or cut (probably others). Which to use and how to use them depends on the layout of your data.

- The GNU Awk User's Guide
- Linux Commands Directory
 
Old 12-28-2012, 05:25 AM   #3
yaswanth4b7
LQ Newbie
 
Registered: Aug 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
hi thax for the reply is these command is correct "cut -c 4 data.txt"
 
Old 12-28-2012, 05:45 AM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,603
Blog Entries: 1

Rep: Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046Reputation: 1046
Quote:
Originally Posted by yaswanth4b7 View Post
hi thax for the reply is these command is correct "cut -c 4 data.txt"
Most probably, not. Why don't you try it and see what happens? This is one of the most basic Awk or cut function, please use google search and you'll get LOTS of examples.

Last edited by sycamorex; 12-28-2012 at 05:53 AM.
 
Old 12-28-2012, 05:52 AM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Quote:
Originally Posted by yaswanth4b7 View Post
hi thax for the reply is these command is correct "cut -c 4 data.txt"
As stated in my previous post: Without knowing what the layout looks like we can point you to commands, not a fully working solution.

Follow sycamorex' advise, it is the only way to learn.
 
Old 12-29-2012, 06:52 PM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950
If I may give some friendly advice...

1) To start with, please use a thread title that has some relevance to your specific problem. "command" could mean almost anything. "Printing only one column?" would be much clearer, and readers who are likely to know the answer will be more likely to click on it.


2) When you post a problem you really need to give more details. Start by explaining the background of your situation, including the environment and tools that are available to you (particularly if it's not a standard Linux setup). Otherwise we have to make assumptions and/or ask you clarifying questions before we can help you.

Then (for text-processing questions at least), provide an actual example of both the input text and the desired output. Finally, be sure to mention any attempts you've already made, and the results you got, including error messages.

Of course, you do have to balance it too. Don't overwhelm us with more detail than is needed to understand your situation.


3) Please take the time to do some research before you post, particularly for common actions like this. There's a whole internet full of advice out there, in addition to the LinuxQuestions archives. A few minutes of searching would certainly answer your question for you, or at least give you leads about where to look next.



4) Finally, when you have time, please read How To Ask Questions The Smart Way. Expressing your questions properly will maximize your chances of getting good results, and save everyone, including you, a lot of time and hassle.



Incidentally, most text processing is done with grep, sed, awk, and the various coreutils like cut. Each of these has both man pages and info pages detailing their options and use, as well as countless examples on the internet.

I particularly recommend taking a look at "info coreutils" for a detailed list of all the applications that it provides.

The shell itself has several built-in features for string manipulation too.


4) Finally, when you have time, please read How To Ask Questions The Smart Way. Expressing your questions properly will maximize your chances of getting good results, and save everyone, including you, a lot of time and hassle.


Good luck!
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command/Script required to send an email alert in case command will not respond rajaniyer123 Linux - General 1 05-19-2012 02:12 PM
Executing shell command from JSP file with command line arg from URL orcusomega Programming 2 01-13-2012 04:38 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 12:21 PM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 02:31 PM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 03:14 AM


All times are GMT -5. The time now is 02:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration