How to store Data in a File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to store Data in a File
# 1  
Old 06-09-2007
How to store Data in a File

I want to read a data from a read command and store it in a file......
Plz send me how I can do that
Ex:
read val
and I want to store this val in a file called temp.
# 2  
Old 06-09-2007
Code:
MYVAR=fred
echo MYVAR = $MYVAR
echo $MYVAR >temp
MYVAR=banana
echo MYVAR = $MYVAR
read MYVAR <temp
echo MYVAR = $MYVAR

# 3  
Old 06-09-2007
Krishna,
One important thing to remember is the difference between
single ">" (creates a new file) and double ">>" (creates the file
if it does not exists, if it exists, appends to it).
This User Gave Thanks to Shell_Life For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Extract data from a file and store it in a variable

Hi , I have an file like below , cat input.txt 'Pattern2' => 'blahdalskdahdlahldahdlakhdlahdlkajdlkaadasdadadadadadadasda ajlalnalndklandlaksdlkaddd' 'Pattern2' => 'aohaonalkndlanldandlandklasnldnaldnak' ............ ........ ..... Here is what am trying to do , I want to grep for... (3 Replies)
Discussion started by: scott_cog
3 Replies

2. Shell Programming and Scripting

Execute sequential files and store data in single file

1)In a particualr path i have a set of inputfiles like path:/defaultmis/MonthlyLoads/INFA_EXPORT_022013/map* example: 1)map_de 2)map_cod 3)map_feg ........and so on in above path there wil be nearly 15 to 20 files starting with map and in other path i have another file input file... (4 Replies)
Discussion started by: katakamvivek
4 Replies

3. Shell Programming and Scripting

Store Large data in Variable in csh

Hi All, This is my first post!! :) How to store huge data in a single variable in csh. Right now i can store upto ~700kb of data. I still want to store more data and i dont want to use perl. Is there any method to store like that...Please let me know.. Thanks (3 Replies)
Discussion started by: vickra
3 Replies

4. Programming

Problem to create class to store data

May I know how do I create a class to store data with different variables? (2 Replies)
Discussion started by: eel
2 Replies

5. UNIX and Linux Applications

Retrieving data from a database and store to a file

Hi I'm using and Oracle 10g Database. I want to write a script to retrieve data from the database and store it toa file. I'm using simple sql statements such as Select * from celltable I don't know how to specify the database name etc. I have this but it doesn't work ... (1 Reply)
Discussion started by: ladyAnne
1 Replies

6. Shell Programming and Scripting

Store data from dynamic website table

hi everybody, Asking for something that I´m not sure if it´s possible to implement. I hope be clear enough. Well, my issue is that I´m looking how to copy or extract a particular table content of a website. I get the content from a external feed (Iframe format), the content is updated every... (1 Reply)
Discussion started by: cgkmal
1 Replies

7. Shell Programming and Scripting

store the table data in excel file

Hello - I have a below table and i want to extract the data into excel sheet and send to different location. Here is the table structure... SQL> desc t_i1_exportdocs Name Null? Type ----------------------------------------- --------... (11 Replies)
Discussion started by: govindts
11 Replies

8. Shell Programming and Scripting

extracting data and store in database

Hello all, I have this text file data. The data are separated by comma in three column and space or line feed to start a new row anderson helberg, Jane, brother Sister ,mother,grandpa bombay,new york, china I would like store them in the following format. field1 ... (2 Replies)
Discussion started by: mam
2 Replies

9. Shell Programming and Scripting

How to store the data retrived by a select query into variables?

Hi Friends, Can u please help mw with the following query . I need to run a database sql statement to select particular fields from a table.I need to store the retrieved filed values into variables so that i can print it in a specific format. But the particular select query retrieves more... (12 Replies)
Discussion started by: jisha
12 Replies
Login or Register to Ask a Question