Creating a file that contains output from a command, and then displays itself

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Creating a file that contains output from a command, and then displays itself
# 1  
Old 10-16-2008
Creating a file that contains output from a command, and then displays itself

hey, I'm trying to create the command that will create a file named user.txt that contains the output of the command cut -d: -f1,5 /etc/passwd, and displays itself afterwards.

I don't know how to bridge cat > user.txt with cut -d: -f1,5 /etc/passwd, or how display it afterwards. Any help would be greatly appreciated. Thanx.
# 2  
Old 10-16-2008
Not sure I fully understand your requirement, but maybe tee is the command you're looking for? Read the man page and see...
# 3  
Old 10-17-2008
Originally Posted by Annihilannic
Not sure I fully understand your requirement, but maybe tee is the command you're looking for? Read the man page and see...
i think you are right Annihilannic he is looking for something like this..
cut -d: -f1,5 /etc/passwd | tee user.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

creating separate output file for each input file in python

Experts, Need your help for this. Please support My motive is to create seperate output file for each Input Files(File 1 and File2) in another folder say(/tmp/finaloutput) Input files File 1( a,b,c 43,17104773,3 45,17104234,4 File 2( a,b,c 43,17104773,1... (2 Replies)
Discussion started by: as7951
2 Replies

2. Shell Programming and Scripting

Script Output Displays Multiple Text

Hello there, I'm using a read-while loop to preserve the word Failed within a text file. For example, if the word Failed exist twice in a single text file, my STDOUT should re-direct to a new text file and display Failed twice. My output is attached to this thread. I would like output to... (4 Replies)
Discussion started by: SysAdminRialto
4 Replies

3. Shell Programming and Scripting


I use things like this a lot in ksh and bash, but lately bash has been printing the command for every loop: ... | while read f do if then echo Differ "$f" fi done How to prevent this? (5 Replies)
Discussion started by: DGPickett
5 Replies

4. Shell Programming and Scripting

Insert title as output of command to appended file if no output from command

I am using UNIX to create a script on our system. I have setup my commands to append their output to an outage file. However, some of the commands return no output and so I would like something to take their place. What I need The following command is placed at the prompt: TICLI... (4 Replies)
Discussion started by: jbrass
4 Replies

5. Solaris

Last command displays wrong information

Hi am having Solaris10 - Sun-Fire-V890 server, the information displayed by Last command is wrong how do i get this sorted without loosing any datas.. # uptime 12:32am up 20 day(s), 33 min(s), 1 user, load average: 1.54, 1.82, 1.93 # last reboot reboot system boot Sat... (9 Replies)
Discussion started by: Sojourner
9 Replies

6. Solaris

ls -l displays output with an error

when i use ls command it works normal but when i using additional parameter with ls like ls -l , ls -a... it shows a error followed by the output. # ls -l ./hgfs: Operation not applicable total 12861 -rw-r--r-- 1 root root 0 Jun 1 21:12 1 drwxr-xr-x 2 root root ... (4 Replies)
Discussion started by: chidori
4 Replies

7. Shell Programming and Scripting

Creating output file using Perl

As an simple example, I have the following files fin1.zv being a one column set of number 1 90 2 80 3 60 4 30 5 20 fin2.zv is another file like this 1 10 20 30 40 50 2 60 70 80 90 0 3 90 80 70 60 50 4 40 30 20 10 0 5 10 20 30 40 50 (2 Replies)
Discussion started by: kristinu
2 Replies

8. UNIX for Dummies Questions & Answers

Diff creating special characters in output file

Hi I am comparing 2 files (using diff command) with numerical data in them. In the output file I want only the differences which are in file2 but not in file1. Although I am getting the diffences i am also getting special characters in the output file which i do not want. Can somebody help... (2 Replies)
Discussion started by: ashu_r2001
2 Replies

9. Shell Programming and Scripting

need help with creating dynamic tcl displays

I'm fairly new to tcl scripting and could use a little help. I have a simple list file that will be of unknown size (somewhere between 10 to 20 names). I'd like to create a gui that has a checkbutton for each name in the list and a single action button that will do something for all the checkboxes... (0 Replies)
Discussion started by: scottwevans
0 Replies

10. AIX

who -r displays no output

Hello. I have an AIX machine at 6100-00. We had some strange activity since filling up /tmp. One symptom is that who -r displays no output. It doesn't hang just no output is displayed. We are going to boot the machine, but prior to that I'd like to dig a bit to see what may be causing the... (0 Replies)
Discussion started by: maficdan
0 Replies
Login or Register to Ask a Question

Featured Tech Videos