Sponsored Content
Top Forums Shell Programming and Scripting Creating a file from input stream Post 302871203 by nexional on Tuesday 5th of November 2013 04:34:53 PM
Old 11-05-2013
Creating a file from input stream

Hi,

Need some help with creating a file from input steam. Meaning from following command myfunc should be able to store the input stream to a file.

Code:
echo a b c | myfunc

The file thus created should have -

Code:
a
b
c

Here's what I've tried in myfunc() but didn't help -

Code:
myfunc() { cat &0 > /tmp/1 }

 

10 More Discussions You Might Find Interesting

1. Programming

File I/O Stream

Hi All, I am trying to read data from two files and then compare them and only print the records on the screen that have a same ID.i.e TAGNO =CUSTOMERNO For Eg My Input Files are (a) Transaction (b) Customer detail The data in file a is like: TagNo Date Time Station... (0 Replies)
Discussion started by: rooh
0 Replies

2. Shell Programming and Scripting

creating unique lists from user input

hi all, I'm trying to resolve a scenario where we prompt the user to enter 1 or more disk names. From there we would run a command on each disk which would give its location. This would allow us to create a list of disks at location A, a list of disks at location B,....etc... Any help... (1 Reply)
Discussion started by: annie
1 Replies

3. Shell Programming and Scripting

creating files and getting input from another file

I have a file where i have files name with absolute path. Ex: files.dat and contents are: /root/xy/yz/zz/abc.txt /root/xx/yy/zz/ac.txt /root/xz/yz/zx/bc.txt /root/xy/yz/zx/abcd.txt now i want to create all above files(dummy files and can be 0 byte). i thought of using touch but it doesn't... (10 Replies)
Discussion started by: ajayyadavmca
10 Replies

4. UNIX for Dummies Questions & Answers

Get the last value in the input stream

Hello Everyone, The situation is: $ alias rm="sh abc.sh" #abc.sh: read input echo "The input was: " $input $ rm xyz.txt should return "The input was: xyz.txt" Here, I want the alias "rm" to execute the file "abc.sh", where "abc.sh" should take "xyz.txt"... (1 Reply)
Discussion started by: qasim
1 Replies

5. Shell Programming and Scripting

[Video stream] network stream recording with mplayer

Hi I used this command: mplayer http://host/axis-cgi/mjpg/video.cgi -user root -passwd root \ -cache 1024 -fps 25.0 -nosound -vc ffh264 \ -demuxer 3 -dumpstream -dumpfile output.avi It's ok but... Video Playing is very fast! Why? Is it a synch problem? What parameter I have to use for... (1 Reply)
Discussion started by: takeo.kikuta
1 Replies

6. Shell Programming and Scripting

Creating Dynamic Input or daa files

Hi, I got a requirement to automate the process. We have SLA files, there are some 80 SLA files comes from 1.30pm - 5.30pm. I was asked to write a script to check for the SLA files in the load directory, if the files come then we got to send the mail to the group, if the mails doesnt come... (1 Reply)
Discussion started by: afahmed
1 Replies

7. Shell Programming and Scripting

[KSH] Creating automatic variable from read input

Hello there, I am posting to seek help with a KSH script, I am making a simple calculation program where the user can enter as many numbers as they like, I am getting their input using the read command, however I am not sure how to repeat doing this and storing the input in to new variables... (7 Replies)
Discussion started by: pandapowerbox
7 Replies

8. Shell Programming and Scripting

Creating a script requiring a pause for user input

Hi I'm trying to create a basic script that pauses for user input to verify a file name before generating the output. I have numerous SSL certificate files which I am trying to determine the expiry date so what I'm trying to do is write a script so that is pauses to request the name of the .pem... (9 Replies)
Discussion started by: Buddyluv
9 Replies

9. UNIX for Dummies Questions & Answers

Creating a new directory by getting input from user

Hi All, I am really new to Linux.I am trying to write a script for creating a new directory by getting input of folder name from the user.Please help me in this regard. #! /bin/bash echo "Enter name of dir":$filename mkdir -p $filename When executing this I am getting following error ... (13 Replies)
Discussion started by: Pradeep_1990
13 Replies

10. 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(1.1.1.1.csv) a,b,c 43,17104773,3 45,17104234,4 File 2(2.2.2.2.csv) a,b,c 43,17104773,1... (2 Replies)
Discussion started by: as7951
2 Replies
popen(3)						     Library Functions Manual							  popen(3)

Name
       popen, pclose - initiate I/O to/from a process

Syntax
       #include <stdio.h>

       FILE *popen(command, type)
       char *command, *type;

       pclose(stream)
       FILE *stream;

Description
       The arguments to are pointers to null-terminated strings containing respectively a shell command line and an I/O mode, either "r" for read-
       ing or "w" for writing.	It creates a pipe between the calling process and the command to be executed.  The  value  returned  is  a  stream
       pointer that can be used (as appropriate) to write to the standard input of the command or read from its standard output.

       A stream opened by should be closed by which waits for the associated process to terminate and returns the exit status of the command.

       Because open files are shared, a type "r" command may be used as an input filter, and a type "w" as an output filter.

Diagnostics
       The routine returns a null pointer if files or processes cannot be created, or the shell cannot be accessed.

       The routine returns -1 if stream is not associated with a `popened' command.

Restrictions
       Buffered reading before opening an input filter may leave the standard input of that filter mispositioned.  Similar problems with an output
       filter may be forestalled by careful buffer flushing, for instance, with For further information, see

       The routine always calls and never calls

See Also
       sh(1), pipe(2), wait(2), system(3), fclose(3s), fopen(3s)

																	  popen(3)
All times are GMT -4. The time now is 12:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy