Sponsored Content
Top Forums UNIX for Dummies Questions & Answers a dummy question...needs help... Post 302255592 by chatwizrd on Thursday 6th of November 2008 07:11:34 PM
Old 11-06-2008
cut -d ' ' -f1

If you use ' ' as the delimiter you can get the field you want. Make sure you put a space between the ' things.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix dummy's question

:confused: Hi, 2 questions to get some insight. Thanks (1) I would like to add a prefix (XX00) in each row of the line in my text file and save a newly generated file another name. How to go about it. (2) How to insert a blank line into each row in my file. and save the file another name.... (2 Replies)
Discussion started by: merry susana
2 Replies

2. UNIX for Dummies Questions & Answers

question from a dummy

okay so I just started this unix class and understood all the test questions but this "normal" question threy me through a loop :confused:. The question is Why are UNIX commands noninteractive and why is their output not usually preceededby header information? This question has been driving me... (2 Replies)
Discussion started by: cinnamonbear
2 Replies

3. Filesystems, Disks and Memory

A simple dummy question

Hello Everyone! changing from Microsoft to Macintosh, I connected my hard disk (nearly full) to the apple computer, which could not recognize it. I was prompt to "initialize it", unfortunately I DECIDED YES!!, but just for 1/100 of a second: now I cannot access the hard disk at all. Is still... (1 Reply)
Discussion started by: NETTO68
1 Replies

4. UNIX for Dummies Questions & Answers

cut awk dummy question :)

how to make cut and awk treat "a b" as a single column rather then two separate columns "a and b"? how to remove " symbol from "a b" so there is only a b? Please help Regards Karol (14 Replies)
Discussion started by: sopel39
14 Replies

5. UNIX for Dummies Questions & Answers

Dummy question about /proc/cpuinfo

Perhaps this is a very dummy question but sorry I don't know other place to do it. We just buy a new cluster of Xeon machines but there is something I don't understand and perhaps someone can help me. The more /proc/cpuinfo produces the following output (just part of it). processor : 0... (1 Reply)
Discussion started by: jhc
1 Replies

6. UNIX for Dummies Questions & Answers

dummy question on data process

I have a file which contains 6 columns. But I only need the first 3 columns. So I need to remove the last 3 columns. I checked 'cut' but it seems not working. So is there a command that could remove certain columns from a file? :( Thanks a lot!! (5 Replies)
Discussion started by: kaixinsjtu
5 Replies

7. UNIX for Dummies Questions & Answers

a dummy question on data processing

Hi, everyone, I have a matrix, let's say: 1 2 3 4 5 6 ... 4 5 6 7 8 9 ... 7 8 9 1 2 3 ... 3 4 5 6 7 8 ... ......... (nxm matrix) Is there a simple command that can take certain specific rows out of the matrix? e.g., I want to take row 2 (4 5 6 7 8 9 ...) and row 4 (3 4 5 6 7 8... (2 Replies)
Discussion started by: kaixinsjtu
2 Replies

8. IP Networking

DNS dummy question

Hello everyone, I have a some doubt about DNS. We have connected to 2 ISPs /ISP#1 and ISP#2/. Our web site's dns zone is located on ISP#1. If connection to ISP#1 is down clients won't find our website. ISP#1 connection went down few times this month. So we are going to create our website's... (0 Replies)
Discussion started by: sembii
0 Replies

9. UNIX for Dummies Questions & Answers

Dummy question on awk

Hi, I have a file which has three columns and 200 rows. I would like to print an extra column say "disco" for every 10 th row starting from 4 th row. How is that possible? Thnx (4 Replies)
Discussion started by: Indra2011
4 Replies

10. UNIX for Beginners Questions & Answers

Dummy Question

Where can I get UNIX? (1 Reply)
Discussion started by: ciao303
1 Replies
CUT(1)							    BSD General Commands Manual 						    CUT(1)

NAME
cut -- cut out selected portions of each line of a file SYNOPSIS
cut -b list [-n] [file ...] cut -c list [file ...] cut -f list [-w | -d delim] [-s] [file ...] DESCRIPTION
The cut utility cuts out selected portions of each line (as specified by list) from each file and writes them to the standard output. If no file arguments are specified, or a file argument is a single dash ('-'), cut reads from the standard input. The items specified by list can be in terms of column position or in terms of fields delimited by a special character. Column and field numbering start from 1. The list option argument is a comma or whitespace separated set of increasing numbers and/or number ranges. Number ranges consist of a num- ber, a dash ('-'), and a second number and select the columns or fields from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all columns or fields from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all columns or fields from the last number to the end of the line. Numbers and number ranges may be repeated, overlap- ping, and in any order. It is not an error to select columns or fields not present in the input line. The options are as follows: -b list The list specifies byte positions. -c list The list specifies character positions. -d delim Use delim as the field delimiter character instead of the tab character. -f list The list specifies fields, separated in the input by the field delimiter character (see the -d option). Output fields are separated by a single occurrence of the field delimiter character. -n Do not split multi-byte characters. Characters will only be output if at least one byte is selected, and, after a prefix of zero or more unselected bytes, the rest of the bytes that form the character are selected. -s Suppress lines with no field delimiter characters. Unless specified, lines with no delimiters are passed through unmodified. -w Use whitespace (spaces and tabs) as the delimiter. Consecutive spaces and tabs count as one single field separator. ENVIRONMENT
The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of cut as described in environ(7). EXIT STATUS
The cut utility exits 0 on success, and >0 if an error occurs. EXAMPLES
Extract users' login names and shells from the system passwd(5) file as ``name:shell'' pairs: cut -d : -f 1,7 /etc/passwd Show the names and login times of the currently logged in users: who | cut -c 1-16,26-38 SEE ALSO
colrm(1), paste(1) STANDARDS
The cut utility conforms to IEEE Std 1003.2-1992 (``POSIX.2''). HISTORY
A cut command appeared in AT&T System III UNIX. BSD
August 8, 2012 BSD
All times are GMT -4. The time now is 11:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy