How to get the shell script to read the .txt file as an input/data?
i have written my shell script in notepad however i am struggling to pass the data file to be read to the script the data file is of .txt format. My target is to run the shell script from the terminal and pass 3 arguments e.g. polg@DESKTOP-BVPDC5C:~/CS1420/coursework$ bash valsplit.sh input.txt correct.txt incorrect.txt . input.txt to be the file that is read and corrct and incorrect.txt is to be written to.
below is the script
here is the .txt file to be read called input.txt
#i n p u t . t x t
add $s0 $s1 $s2
sub $s2 $t0 $t3
add $s0 $s1 $z2
lw $t1 8($t2)
addi $t3 $s0 −9
sw $s3 4($t0)
lw $t11 70000($s0)
please can someone see what is wrong with my script and why it wont read my file and can someone coach me on how to run the script from the terminal.
i get this message when i attempt to run the script in the terminal like this : ./valsplit.sh input.txt correct.txt incorrect.txt
error message = valsplit.sh: line 6: $'\r': command not found
valsplit.sh: line 7: syntax error near unexpected token `$'{\r''
'alsplit.sh: line 7: `function checkImmediate {
When you see \r, it means "stop editing your files in Microsoft Notepad". It has filled your file with invisible carriage returns which will stop it from working.
When you see \r, it means "stop editing your files in Microsoft Notepad". It has filled your file with invisible carriage returns which will stop it from working.
You can clean it up with:
inputfile and outputfile cannot be the same.
Where would I exactly write those commands? And any idea on how to get the shell to read the input file? Any advice on what to write the input file in instead of notepad?
Hi dears
i have text file like this:
INPUT.txt
001_1_173 j nuh ]az
001_1_174 j ]esma. nuh ]/.xori
.
.
. and have another text
like this
TABLE.txt
j j
nuh word1... (6 Replies)
Hi, I am complete new to C programming and shell scripting. I just wrote a simple C code to calculate integral using trapezoid rule. I am prompting user to pass me No. of equally spaced points , N , upper and lower limit. My code looks as follows so far:
#include<stdio.h>
#include<string.h>... (2 Replies)
Dear experts,
I am new to linux programming. I have a shell script which i should run it on all my samples.
I only define input and out put for this script. The inputs are 3 numbers(coordination numbers) which are available in a series of text file.
Since i have a lots of samples, it takes a... (5 Replies)
Hi ...programmers...
I need a shell script to perform some specific task..
my txt file looks like this
netcdf new {
dimensions:
XAX1_11 = 11 ;
variables:
double XAX1_11(XAX1_11) ;
XAX1_11:point_spacing = "even" ;
XAX1_11:axis = "X" ;
float DEPTH(XAX1_11) ;... (19 Replies)
Hi Frnds...
I have an input file name.txt and another file named as source.. name.txt is having only one column and source is having around 25 columns...i need to read from name.txt line by line and search it in source file and then save the result in results file..
I have a rough idea about the... (15 Replies)
Hi all,
Help needed urgently.
I am currently writing a shellscript to read data/record from a flat file (.txt) file, and import/upload the data to oracle database. The script is working fine, but it takes too long time (for 18000 records, it takes around 90 mins).
I guess it takes so long... (1 Reply)
The scope of the shell/perl script is to read the input text file. Validate the expiry date of each certificate and send the mail to the user. The user takes action to add the new certificate to the storage file and user owns the responsibility to update the input text file with the new certificate... (5 Replies)
I need to read data from a file called "test.csv" through shell script where the file contains values like name,price,descriptor etc. There are rows where descriptor (& in some rows name) are written as string & other characters like "car_+" OR "bike*" etc where it should contains strings like... (3 Replies)
I am having one text file and i need to read that data from my shell script.
I will expain you the scenario:
Script look like:
For name type 1:
For age type 2:
For Salary type3:
echo "Enter the input:"
read the data
if input is 1 then go to the Text file and print the... (2 Replies)