05-04-2017
URGENT Reading a file and assessing the syntax shell script URGENT
I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being read follows the syntax then it should be sent to another file called correct.txt if the syntax is incorrect of the line then it should be sent to incorrect.txt. I have been struggling to get the shell script to read the file and then assess the syntax. Please could someone help
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need a help in deleting a line matching a particular pattern in a file using shell script without opening the file. The file is a .c/.cpp file. Is it possible?
Thanks (6 Replies)
Discussion started by: naan
6 Replies
2. Shell Programming and Scripting
Hi,
I have a file whose content and format at places is as given below.
print
coloumn ....
coloumn ....
coloumn ....
skip 1 line
print
coloumn ...
skip 1 line
I need to select the following :
print
coloumn ....
coloumn ....
coloumn... (2 Replies)
Discussion started by: jisha
2 Replies
3. Shell Programming and Scripting
Hi,
I want to extract block of data from flat file.
the data will be like this
start of log
One
two
three
end of log
i want all data between start of log to end of log i.e One
two
three to be copied to another file.
This particular block may appear multiple times in same file. I... (4 Replies)
Discussion started by: shirish_cd
4 Replies
4. Shell Programming and Scripting
Hi friends,
I am working as a DataStage developer. I need help in writing shell script.
I have following file and I want to remove data from 1st field and store it into other file.
Convert this file,
A100 Tylenol 100mg
A100 PCML 500mg
B120 CFDR 250mg
C345 PFLX 600mg
... (4 Replies)
Discussion started by: sunnysunny
4 Replies
5. Shell Programming and Scripting
Hi,
I am new to shell scripting.
I have one .txt file whose name is status.txt
Now i want to read the contents of this file in a variable.
status.txt file contains the following input
1.xml
2.ps
3.pdf
now i want to read this status.txt file. Can anybody please help me to write a... (2 Replies)
Discussion started by: sunitachoudhury
2 Replies
6. Shell Programming and Scripting
All Expert,
I am using Sun OS 5.8 and Perl version 5 in One server and Perl 5.8 in another unix server.
I am able to read a file using fopen function of perl --file size having more then 3 GB of data.(In the machine where Perl 5.8 install)
But when i am running the same perl script --It... (1 Reply)
Discussion started by: jambesh
1 Replies
7. Shell Programming and Scripting
Hi,
I need help urgently for following issue. Pls help me to resolve this issue.
I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql)
I given... (6 Replies)
Discussion started by: praka
6 Replies
8. Shell Programming and Scripting
I have written a shell script to Automatically FTP a file. The script runs fine when doing it manually but when I schedule it using a crontab it gives me an error.
.
.
.
echo "-----------------Starting File FTP---------------------" >> $PROS_LOAD_LOG
echo "open X.XX.XX.XXX" >>... (13 Replies)
Discussion started by: tanhajoy
13 Replies
9. Shell Programming and Scripting
I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (8 Replies)
Discussion started by: Gurdza32
8 Replies
10. Shell Programming and Scripting
Hello,
I have below string, even I have hundreds of lines in a file. I want to exactly match last two consecutive strings.
2017-09-30|ACBD,TVF|01234|NULL|18|NULL|686091802|BANK OF ABCD, LIMITED, THE|2017-09-30 00:00:00
I want to extract the string 2017-09-30 00:00:00
How can I do... (1 Reply)
Discussion started by: shellquery26666
1 Replies