i have one script for this script manual input i am giving.
step 1: tclsh /india/ksantosh/innovus/scripts/def_file.tcl step 2: it will ask "def_file.def"
step3: it will ask offset_x value "20"
step 4: it will ask for offset_y value "20"
step 5: it will execute the script and generate modified "def_file.modified.def"
but I want to execute this in one line to save time tclsh /india/proj_n16_hbm2etigris/n16_hbm2etigris/be/work/ksantosh/innovus/scripts/def_file.tcl def_file.def 20 20
It should work like /india/proj_n16_hbm2etigris/n16_hbm2etigris/be/work/ksantosh/innovus/scripts/def_file.tcl<input_def> <outputs_def> <x_offset> <y_offset> If output-file is not given then it should be<input_def>_modifed.def
where def_file.tcl have this code
puts "Enter input file name:"
flush stdout
gets stdin filename
set input_def [open $filename r]
# create output file name based on input file name
set output_filename [file rootname $filename]_modified.[file extension $filename]
set output_file [open $output_filename w]
puts "Enter offset_x:"
flush stdout
gets stdin offset_x
puts "Enter offset_y:"
flush stdout
gets stdin offset_y
set star *
while {[gets $input_def line] >=0} {
if {[ string match {UNITS DISTANCE MICRONS*} $line]} {
set Micron_Unit [lindex [split $line] 3]
set Micron_Unit [format "%.1f" $Micron_Unit]
}
if {[string match {*ROUTED*} $line] || [string match {*FIXED*} $line] || [string match {*COVER*} $line] || [string match {*SHIELD*} $line] } {
puts $line
} else {
puts $output_file $line
}
}
close $input_file
close $output_file
It sounds like you need command line arguments. You may define your command format like this:
def_file.tcl <input_def> <x_offset> <y_offset> [<output_def>]
Where <output_def> is optional. In you tcl script file, add the following code:
if { $argc < 3 } {
puts "Usage: $argv0 <input_def> <x_offset> <y_offset> \[<output_def>\]"
exit
}
lassign $argv input_def x_offset y_offset output_def
if { [string length $output_def] == 0 } {
set output_filename [file rootname $input_def]_modified.[file extension $input_def]
}