Error executing Linux command using tcl
NickName:NewCoder Ask DateTime:2017-09-07T06:47:56

Error executing Linux command using tcl

I have the following TCL script which executes a Linux command to format a file.

exec sed -r '2,$s/(.{55} )/\1\n\t/g' $formatfileName | sed 's/ $//' > $formatfileName

I get an error saying can't read "s": no such variable while executing the above line - It is considering $ sign in Linux command as a variable. I tried to put curly braces {} but that did not work.

Can you please advise how to use the above command without errors? Thanks for your help.

Copyright Notice:Content Author:「NewCoder」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/46085397/error-executing-linux-command-using-tcl

More about “Error executing Linux command using tcl” related questions

Error executing Linux command using tcl

I have the following TCL script which executes a Linux command to format a file. exec sed -r '2,$s/(.{55} )/\1\n\t/g' $formatfileName | sed 's/ $//' > $formatfileName I get an error saying can't ...

Show Detail

executing a linux command from a TCL file

I want to run a command inside a tcl file. According to Unix examples, I wrote: .... exec export LD_LIBRARY_PATH=/opt/gcc-4.1.2-built/lib64 puts $gofile "#!/bin/bash .... However I get this error:

Show Detail

how to run unix command with tcl/expect

I'm new to tcl. I'm trying to run some commands with tcl script. I searched online and came to know that we can run unix commands with tcl using exec I executed the following; perl -i -p -e 's/...

Show Detail

how to implement a exec command in tcl?

It is possible to call other programs from Tcl using the Tcl exec function. Let’s use this command to create a Tcl script that will take all of the Tcl code you have written so far and create a sin...

Show Detail

Executing TCL (expect script) using perl on windows

I'm running the tcl(which has expect script) using perl with, system("C:/Tcl/bin/tclsh86 C:/Users/sysadmin/desktop/expect.tcl"); It's not executing the all commands in the script, but its workin...

Show Detail

Facing error while running tcl script with an argument using source command

I am trying to source a tcl script inside another script using source command . The syntax i am using is as follows : source /path/script.tcl vikas #vikas is as a argument to the script Bu...

Show Detail

Using TCL to drive a linux shell

I am new to the TCL language and I would like to use scripts I write to automate some simple tasks that I would normally execute in the Linux terminal interface (or some other shell). My goal right...

Show Detail

Linux equivalent in Tcl

I am writing Tcl scripts, just checking if the following Linux command can be written using Tcl instead. csplit --digits=3 --quiet --prefix=$abc $inputfile /~$position/Thanks for your help!

Show Detail

Error while executing linux command using Java

I'm trying to execute the following command using Java Process acquirInterfaces = Runtime.getRuntime().exec("dumpcap -D"); and getting error as java.io.IOException: Cannot run program "dumpcap":...

Show Detail

Passing variable to sed command in tcl

I am having a issue where i am trying to substitute a variable in sed command while executing it in TCL shell. Below is what i tried. set variable 5 exec sed "s/test1\$/test1;test1 $variable/g" ...

Show Detail