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

input from user and save it as .txt

Closed Thread    
Thread Tools Search this Thread Display Modes
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
Old 07-10-2013
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
Join Date: Sep 2007
Last Activity: 19 December 2014, 2:53 AM EST
Location: St. Gallen, Switzerland
Posts: 6,251
Thanks: 126
Thanked 455 Times in 414 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 you should be able to get a start going.
Sponsored Links
Old 07-10-2013
Subbeh Subbeh is offline
Registered User
Join Date: May 2011
Last Activity: 16 December 2014, 8:22 AM EST
Posts: 330
Thanks: 36
Thanked 86 Times in 85 Posts

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 05:24 PM
Pattern search and save it as .txt file with some name.. j_panky Shell Programming and Scripting 15 07-19-2011 10:27 AM
How to add data from 2 input files and save it in 1 output file redse171 Shell Programming and Scripting 4 12-16-2010 12:57 AM
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 10:13 PM
Save Excel file as .txt in UNIX format jroyalty UNIX for Dummies Questions & Answers 2 04-08-2009 03:46 PM

All times are GMT -4. The time now is 04:07 PM.