how to read a file using shell ??

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to read a file using shell ??
# 8  
Old 09-18-2007

I tried the awk code from blowtorch and it worked for me (I placed it in a shell script and adjusted the filenames and data with the ones provided).

I suggest you post the exact code you ran and the exact error message you received ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell Script to Read the given file contents into a merged one file

Like to have shell script to Read the given file contents into a merged one file with header of path+file name followed by file contents into a single output file. While reading and merging the file contents into a single file, Like to keep the format of the source file. ... (4 Replies)
Discussion started by: Siva SQL
4 Replies

2. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

3. Shell Programming and Scripting

Shell script to read specified value from file and echo to the same location to other file.

Hello. I want to to backup some "default:" values from a file do some other job and after restore that "default:" values back. The problem is that the source and destination file has a lot of default: strings in it but with different values... So.. Here is an example: A part of my source... (6 Replies)
Discussion started by: ausdim
6 Replies

4. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

5. Shell Programming and Scripting

Shell script to read file and check file type

Hi, I have a file with few values in it. I need script help to read file line by line and check: 1/if it's a file (with extension eg .java .css .jar etc ) or 2/if it's a file without extension and treat it as a directory and then check if the directory exists in working copy else create one... (6 Replies)
Discussion started by: iaav
6 Replies

6. Shell Programming and Scripting

Need shell script to read two file at same time and print out in single file

Need shell script to read two file at same time and print output in single file Example I have two files 1) file1.txt 2) file2.txt File1.txt contains Aaa Bbb Ccc Ddd Eee Fff File2.txt contains Zzz Yyy Xxx (10 Replies)
Discussion started by: sreedhargouda
10 Replies

7. Shell Programming and Scripting

To read and separate number and words in file and store to two new file using shell

hi, I am a begginer in unix and i want to know how to open a file and read it and separate the numbers & words and storing it in separate files, Using shell scripting. Please help me out for this. Regards S.Kamakshi (2 Replies)
Discussion started by: kamakshi s
2 Replies

8. Shell Programming and Scripting

Post Shell programming: Question about source a file and read data from the file

This is shell programming assignment. It needs to create a file called .std_dbrc contains STD_DBROOT=${HOME}/class/2031/Assgn3/STD_DB (which includes all my simple database files) and I am gonna use this .std_dbrc in my script file (read the data from the database files) like this: .... (3 Replies)
Discussion started by: ccwq
3 Replies

9. Shell Programming and Scripting

Read words from file and create new file using K-shell.

Hi All, Please help me in creating files through K-shell scripts. I am having one file in this format. OWNER.TABLE_NAME OWNER.TABLE_NAME1 OWNER1.TABLE_NAME OWNER1.TABLE_NAME1 I want to read the above file and create new file through k shell script. The new file should looks like this.... (4 Replies)
Discussion started by: bsrajirs
4 Replies

10. UNIX for Advanced & Expert Users

How to read from a file in C shell?

Hi All, I want to read some number from a file into a variable in C shell as follows. I know that the syntax in ksh is read x < file name I dont know what's the equivalent for this in C Shell Can some one pls. help me out? Thanks in advance raju (2 Replies)
Discussion started by: rajugp1
2 Replies
Login or Register to Ask a Question
SCRIPT(1)							   User Commands							 SCRIPT(1)

script - make typescript of terminal session SYNOPSIS
script [options] [file] DESCRIPTION
script makes a typescript of everything displayed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves the dialogue in this file. If no filename is given, the dialogue is saved in the file type- script. OPTIONS
-a, --append Append the output to file or to typescript, retaining the prior contents. -c, --command command Run the command rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty. -e, --return Return the exit code of the child process. Uses the same format as bash termination on signal termination exit code is 128+n. -f, --flush Flush output after each write. This is nice for telecooperation: one person does `mkfifo foo; script -f foo', and another can supervise real-time what is being done using `cat foo'. --force Allow the default output destination, i.e. the typescript file, to be a hard or symbolic link. The command will follow a symbolic link. -q, --quiet Be quiet (do not write start and done messages to standard output). -t[file], --timing[=file] Output timing data to standard error, or to file when given. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays. -V, --version Display version information and exit. -h, --help Display help text and exit. NOTES
The script ends when the forked shell exits (a control-D for the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal. It is not recommended to run script in non-interactive shells. The inner shell of script is always interactive, and this could lead to unexpected results. If you use script in the shell initialization file, you have to avoid entering an infinite loop. You can use for example the .profile file, which is read by login shells only: if test -t 0 ; then script exit fi You should also avoid use of script in command pipes, as script can read more input than you would expect. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism), scriptreplay(1) HISTORY
The script command appeared in 3.0BSD. BUGS
script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. script is primarily designed for interactive terminal sessions. When stdin is not a terminal (for example: echo foo | script), then the session can hang, because the interactive shell within the script session misses EOF and script has no clue when to close the session. See the NOTES section for more information. AVAILABILITY
The script command is part of the util-linux package and is available from Linux Kernel Archive < /util-linux/>. util-linux June 2014 SCRIPT(1)