• Priniting coloumns of a file using tcl

    From gparthu@gmail.com@21:1/5 to All on Sat Aug 21 10:47:42 2021
    Dear Experts,

    I am able to print the required columns in an output file with awk command using following command in a .SH file
    awk '{ print $1,$2,$5,$6 }' input_file1 > output_file2

    I want achieve the same thing using tcl command
    But when i used following command in a .TCL, file it throws the following error
    exec awk '{ print $1,$2,$5,$6 }' input_file1 > output_file2
    can't read "1": no such variable

    Could you please give me a correct syntax for the above issue?

    Thanks
    Parth

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to gpa...@gmail.com on Sat Aug 21 18:17:58 2021
    On Sat, 21 Aug 2021 10:47:42 -0700, gpa...@gmail.com wrote:

    Dear Experts,

    I am able to print the required columns in an output file with awk command using following command in a .SH file
    awk '{ print $1,$2,$5,$6 }' input_file1 > output_file2

    I want achieve the same thing using tcl command
    But when i used following command in a .TCL, file it throws the following error
    exec awk '{ print $1,$2,$5,$6 }' input_file1 > output_file2
    can't read "1": no such variable

    Could you please give me a correct syntax for the above issue?

    Not really. tcl is (now) a moderately obscure scripting language, and
    while I have the book ("Tcl and the Tk toolkit" by John K. Ousterhout)
    I don't /know/ the language.

    Please realize that the argument handling and quoting requirements of
    TCL are /not/ the same as posix shell, and you will have to do some work
    to translate from shell to TCL. If you are working in TCL, you probably
    need to read the book; "Tcl and the Tk toolkit" is the canonical book on
    TCL, written by the author of the TCL language.

    HTH
    --
    Lew Pitcher
    "In Skills, We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Elvidge@21:1/5 to Lew Pitcher on Sat Aug 21 19:49:18 2021
    On 21/08/2021 07:17 pm, Lew Pitcher wrote:
    On Sat, 21 Aug 2021 10:47:42 -0700, gpa...@gmail.com wrote:

    Dear Experts,

    I am able to print the required columns in an output file with awk command using following command in a .SH file
    awk '{ print $1,$2,$5,$6 }' input_file1 > output_file2

    I want achieve the same thing using tcl command
    But when i used following command in a .TCL, file it throws the following error
    exec awk '{ print $1,$2,$5,$6 }' input_file1 > output_file2
    can't read "1": no such variable

    Could you please give me a correct syntax for the above issue?

    Not really. tcl is (now) a moderately obscure scripting language, and
    while I have the book ("Tcl and the Tk toolkit" by John K. Ousterhout)
    I don't /know/ the language.

    Please realize that the argument handling and quoting requirements of
    TCL are /not/ the same as posix shell, and you will have to do some work
    to translate from shell to TCL. If you are working in TCL, you probably
    need to read the book; "Tcl and the Tk toolkit" is the canonical book on
    TCL, written by the author of the TCL language.

    HTH


    First result from a search: https://stackoverflow.com/questions/16990116/using-awk-in-tcl-script


    --
    Chris Elvidge
    England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)