It is quite simple: you need a (recursive) parser for this, the same way the language is interpreted (i suppose?) by one. I suggest to retrieve your yacc utility and start writing...
If you are looking for a regex-solution (grep, sed, awk, ...): none of these will work correctly, because languages are context-sensitive. Consider i.e. :
and:
and that is just one of the myriads of possibilities to lead a regexp astray.
Hi,
I'm looking to delete some files from directories.
I've just put in a file the location of these files.
e.g:
in file supprs.txt there is:
/usr/host/t1.txt
/etc/dev/u1.java
/home/new/files/view.c
Is it possible to take this file "supprs.txt" as a parameter in a shell command ? (2 Replies)
I want to remove the commented lines in a file identified by ' symbol at the start of each ine. A sample example will be like:
Input
-----
'IFerr_flag=0THEN
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
iferr_flag=0then
Output
-------... (3 Replies)
Hello,
I have a file as follow
a
b
c
c
d
d
e
I would like to write a awk command to insert # from the first occurence of
"c" to the end of the files.
OUTPUT should be like this
a
b
#c (5 Replies)
Hi,
i need some help. i am not sure about my idea.
I have a script directory under my home directory,which has a lot of scripts in it.
These are some names of the scripts in /axxhome/prdv/script
aly300.sh
axt300.sh
arv300.sh
clp300.sh
ctth300.sh
aly400.sh
axt400.sh
arv400.sh... (6 Replies)
Legends,
Can you please help me in following.
I need to comment lines from “/tmp/a.txt” from the line A to line B through the command prompt only.
Please use variables not direct values like 2 or 5
It can be done with VI editor but it's not matches with my requirement (: 2,5 s/^/#/g).
... (1 Reply)
Platform : RHEL 5.4
I have several .sql files in a directory. I want to comment lines 10 to 25 for all .sql files.
How can I do this ?
The symbol for comment in SQL is --
eg:
-- select salary from emp where empname = 'URS' ; (3 Replies)
Please Help (novice to PERL and SHELL scripting)…. Need to create a script which removes all lines in $filename = "cycle_calendar_ftp_out" older than current date – a variable which will be a number of days passed to script. For Ex it will look at the end date which is the last field (4) and... (2 Replies)
AIX.
we have multiple files eg B1234567 B1235468 etc. (numbers change daily, only constant is the B prefix)
trying to use using sed '/numberrange and length varies /d ' to remove a specific number range out of one of these files , we just don't know which one its in, as it could be in... (4 Replies)
Hello,
I have some code that works more or less. This is called by a make file to adjust some hard-coded definitions in the src code. The script generated some values by looking at some of the src files and then writes those values to specific locations in other files. The awk code is used to... (3 Replies)
Discussion started by: LMHmedchem
3 Replies
LEARN ABOUT REDHAT
byacc
YACC(1) BSD General Commands Manual YACC(1)NAME
yacc -- an LALR(1) parser generator
SYNOPSIS
yacc [-dlrtv] [-b file_prefix] [-o output_filename] [-p symbol_prefix] filename
DESCRIPTION
Yacc reads the grammar specification in the file filename and generates an LR(1) parser for it. The parsers consist of a set of LALR(1)
parsing tables and a driver routine written in the C programming language. Yacc normally writes the parse tables and the driver routine to
the file y.tab.c.
The following options are available:
-b file_prefix
Change the prefix prepended to the output file names to the string denoted by file_prefix. The default prefix is the character y.
-d Cause the header file y.tab.h to be written.
-l If the -l option is not specified, yacc will insert #line directives in the generated code. The #line directives let the C compiler
relate errors in the generated code to the user's original code. If the -l option is specified, yacc will not insert the #line
directives. Any #line directives specified by the user will be retained.
-o output_filename
Cause yacc to write the generated code to output_filename instead of the default file, y.tab.c.
-p symbol_prefix
Change the prefix prepended to yacc-generated symbols to the string denoted by symbol_prefix. The default prefix is the string yy.
-r Cause yacc to produce separate files for code and tables. The code file is named y.code.c, and the tables file is named y.tab.c.
-t Change the preprocessor directives generated by yacc so that debugging statements will be incorporated in the compiled code.
-v Cause a human-readable description of the generated parser to be written to the file y.output.
If the environment variable TMPDIR is set, the string denoted by TMPDIR will be used as the name of the directory where the temporary files
are created.
FILES
y.code.c
y.tab.c
y.tab.h
y.output
/tmp/yacc.aXXXXXXXXXX
/tmp/yacc.tXXXXXXXXXX
/tmp/yacc.uXXXXXXXXXX
DIAGNOSTICS
If there are rules that are never reduced, the number of such rules is reported on standard error. If there are any LALR(1) conflicts, the
number of conflicts is reported on standard error.
BSD May 24, 1993 BSD