Get the input from user and save it as .txt file | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Get the input from user and save it as .txt file

Shell Programming and Scripting


Tags
input from user and save it as .txt

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-10-2013
Padmanabhan Padmanabhan is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 12 September 2013, 7:05 AM EDT
Posts: 20
Thanks: 3
Thanked 0 Times in 0 Posts
Get the input from user and save it as .txt file

Hi friends,

I am pretty new to shell scripting, please help me in this Scenario.

for example, If I have one file called input.txt

once I run the script,

1.It has to delete the old input.txt and create the new input.txt (if old input.txt is not there, no offence, just it has to create a new one)

2. User has to paste the IDs (multiple line IDs) in the input.txt as a input.

3. once User Enter the input, it has to save the input.txt.


please help me in that. Thanks in advance. SDorry for my English
Sponsored Links
    #2  
Old 07-10-2013
zaxxon's Avatar
zaxxon zaxxon is online now Forum Staff  
code tag tagger
 
Join Date: Sep 2007
Last Activity: 21 August 2014, 1:51 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,224
Thanks: 121
Thanked 450 Times in 410 Posts
  • Just overwrite the old file with a redirection like echo "" > input.txt
  • Read input with a prompt can be achieved with read . Else could use positional shell parameters of the shell like $1, $2, ...
  • For writing input.txt, redirect as said.

Try it, show your efforts. Ask if you get stuck showing your code.
According to your code in post http://www.unix.com/shell-programmin...only-once.html you should be able to get a start going.
Sponsored Links
    #3  
Old 07-10-2013
Subbeh Subbeh is offline
Registered User
 
Join Date: May 2011
Last Activity: 20 August 2014, 8:49 AM EDT
Posts: 328
Thanks: 35
Thanked 86 Times in 85 Posts

Code:
cat > file

Then paste the ID's and press ctrl-d when finished,
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Open Text file input data and save it. asavaliya Shell Programming and Scripting 1 08-08-2012 04:24 PM
Pattern search and save it as .txt file with some name.. j_panky Shell Programming and Scripting 15 07-19-2011 09:27 AM
How to add data from 2 input files and save it in 1 output file redse171 Shell Programming and Scripting 4 12-15-2010 11:57 PM
select data from oracle table and save the output as csv file or .txt file in unix/solaris - script aemunathan Shell Programming and Scripting 4 11-04-2009 09:13 PM
Save Excel file as .txt in UNIX format jroyalty UNIX for Dummies Questions & Answers 2 04-08-2009 02:46 PM



All times are GMT -4. The time now is 02:16 AM.