The cut command. Really simple question!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting The cut command. Really simple question!
# 1  
Old 08-26-2007
The cut command. Really simple question!

hi, sorry for asking what I am sure is a really easy question, I am wanting to cut the users real name from the output of 'finger'.

$ cut -f2-3 filename

is in my script but it only seems to cut the first line.

I need to cut the 2nd and 3rd word from each line and store them in variables to echo later.

I have been reading the web for ages, and all suggests the above line of code.

Thanks!
# 2  
Old 08-26-2007
hi,
cut -f2,3 -d" " <filename>
this shud work...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cut command: can't make it cut fields

I'm a complete beginner in UNIX (and not a computer science student either), just undergoing a tutoring course. Trying to replicate the instructions on my own I directed output of the ls listing command (lists all files of my home directory ) to My_dir.tsv file (see the screenshot) to make use of... (9 Replies)
Discussion started by: scrutinizerix
9 Replies

2. Linux

A simple question about mail command

Simple question: i read mail n°4,how to return to list of messages? (2 Replies)
Discussion started by: Linusolaradm1
2 Replies

3. Red Hat

Syslog.conf: looking for a simple answer on a simple question

Cheers! In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not? To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies

4. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

5. Shell Programming and Scripting

Simple Cut issue

I have a long string that looks something like this.... <string>http://abc.com/40/20/zzz061-3472/dP3rXLpPPV2KC846nJ4VXpH7jt4b3LJgkL/tarfile_date.tar</string> I need to but the tar file name. So I need to put between "/" and ".tar</string>". My desired result should be "tarfile_date". (7 Replies)
Discussion started by: elbombillo
7 Replies

6. Shell Programming and Scripting

Simple Cut Question

I've got a file that contains a large list of links in this type of style: 'home_dir\2009\09\01\file.html' I'd like to cut off all of the characters left of 'file.html'. I tried: cat file.txt | cut -d\ -f4 but it told me that I had an invalid delimiter. So I tried: cat... (5 Replies)
Discussion started by: Rally_Point
5 Replies

7. UNIX for Dummies Questions & Answers

Question on the cut command

Suppose one has a file consisting of more than 2 columns and one has to extract a few columns from this file and swap some columns at the same time. Example: extract column 1, 2 and 4 from a file foo.csv and place them in the order 2, 4 and 1 into file foo.txt. I would be inclined to do this: cut... (4 Replies)
Discussion started by: figaro
4 Replies

8. Shell Programming and Scripting

Simple question abt Copy command.

Hi ! All This is very simple question.... How to write a 'cp' command interative. Example : cp /wlsuite/om/cm/Tools/deploy_scripts/*.xml ${INF_ROOT}/tmp | echo "" || echo " Pls investigate ..." My intent was > to copy the files. > CP fails... then let know the user. pls... (2 Replies)
Discussion started by: dashok.83
2 Replies

9. UNIX for Dummies Questions & Answers

Simple Command (head) Question

Okay, this probably sounds dumb for anyone who knows the answer, but I'm completely lost. I have to use the head command to search a directory AND all of its subdirectories to display the first line of all .txt files. I know how to do this: head -1 ~/UnixCourse/*.txt, but that does not search the... (4 Replies)
Discussion started by: jbud
4 Replies

10. UNIX for Dummies Questions & Answers

SImple command question

Does anyone know the command to get the date CREATED for a file? This is driving me berserk. Windows has it. But I cannnnnnot remeber what it is in UNIX! Thanks! (4 Replies)
Discussion started by: Diabeticus
4 Replies
Login or Register to Ask a Question