Question about I/O sources


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Question about I/O sources
# 1  
Old 01-03-2013
[solved] Question about I/O sources

Hi all,
What is the difference between these two comands?
sed s/a/b/ <f1 >f2
sed s/a/b/ f1 >f2

Best,
santiagorf

Last edited by santiagorf; 01-03-2013 at 06:57 PM.. Reason: solved
# 2  
Old 01-03-2013
Standard input (stdin) normally comes from your keyboard. Many programs ignore stdin.

E.g. cat filename never reads its standard input; it reads the files directly. But without file names on the command line, UNIX commands that need input will usually read stdin.

Standard input normally comes from your keyboard, but the shell can redirect stdin from a file. This is handy for UNIX commands that can't open files directly.

E.g. mail user@domain.com < filename. To mail a file use < filename to tell the shell to attach the file, instead of your keyboard, to mail's standard input.

sed can read file directly, so no need to redirect stdin from a file. I hope this helps.
# 3  
Old 01-03-2013
Quote:
Originally Posted by santiagorf
Hi all,
What is the difference between these two comands?
sed s/a/b/ <f1 >f2
sed s/a/b/ f1 >f2

Best,
santiagorf
The results from those two commands should be the same.

The difference between them is that in the first case, the shell opens f1 as standard input to be read by sed. In the second case, sed opens and reads f1 using a file descriptor that might or might not (but probably won't) be the standard input file descriptor for sed.
# 4  
Old 01-03-2013
thank you!!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Can anyone provide some sources about bank IT

I am working in IT company working for banks.I find hardly to get technology about bank IT on the internet.Consider banks all using Unix, I think I can get some help here. Recommend some sits or books about bank IT will be very helpful!! (0 Replies)
Discussion started by: hhdzhu
0 Replies

2. Debian

Repositories in sources.list

I'm just interested to know how your sources.list look like. I got some repositories witch give some errors and I would like to clean it up. and when I do apt-get update I get few lines showing errors like 404 , this is how my list look like: # deb cdrom:/ squeeze main # deb cdrom:/... (0 Replies)
Discussion started by: zdorian
0 Replies

3. Solaris

Building OpenSolaris from sources

Everyone knows the project LFS (Linux from scratch), it is a book-assembly instructions GNU / Linux from source code. I managed to gather, then my knowledge of GNU / Linux grew, learned many new commands, edit config-files, base packages, kernel, etc. .. Now I would like also to explore... (0 Replies)
Discussion started by: Geekon
0 Replies

4. News, Links, Events and Announcements

Are the UnixWare 7.1.1 sources available?

So, I was browsing groklaw.net, and I was surprised to read that Pamela Jones was reading the copyright notices in the UnixWare 7.1.1 source code files... Groklaw - Santa Cruz Listed Novell as Owning the Copyrights in 1999 How can that be? Are the UnixWare 7.1.1 sources available to the... (1 Reply)
Discussion started by: pepinox
1 Replies

5. SuSE

FAILED during patching kernel sources

Hi all. I have an issue with kernel patching. My system: OpenSuse 10.2, kernel version: 2.6.18.2. I've downloaded the patch from kernel.org - 2.6.26. I've invoked the following command: "patch -p1 -f < patch-2.6.26" (-f - because some files are not exist. to automatically skip this issues).... (2 Replies)
Discussion started by: Vourhey
2 Replies

6. Linux

Makefile with sources in diferent folders

Hi guys! I have a problem to create a makefile when using 2 types of sources. Suppose we have sources at master_source folder: - 1.c - 2.c and also we have sources at platform_source folder: - 1.c I really need to use platform_source folder because there is many of them (one folder with... (8 Replies)
Discussion started by: borzh62
8 Replies

7. Linux

Kernel sources

I"m installing my ATI card in FC4. I'm going off of instructions that i've found. The firs step says that i need my kernel sources which i've got then it says that i've gotta unpack them so i can make links to the file later. My kernel sources that i've got are .src.rpm I've installed them but... (1 Reply)
Discussion started by: byblyk
1 Replies

8. UNIX for Dummies Questions & Answers

Sources for Raid Information

All, I have worked with UNIX for quite a while but never with raid. My section has just taken control of 3 servers each with different configurations and all running raids. My question for everyone is can you recommend any books that I can purchase or web sites that deal specifically with how to... (1 Reply)
Discussion started by: 3grls=1hd8
1 Replies

9. UNIX for Dummies Questions & Answers

unix sources

hello, i'm looking for the sources of the old, original unices (v3 preferred). could someone point a link? (2 Replies)
Discussion started by: fdarkangel
2 Replies
Login or Register to Ask a Question