Sponsored Content
Full Discussion: TCL reading file
Top Forums Programming TCL reading file Post 302798135 by Syed Imran on Wednesday 24th of April 2013 12:52:30 AM
Old 04-24-2013
Wrench TCL reading file

This is the code i have to read and display each line every time. please let me know the bug in this.. am not getting the output

Code:
 set fp [open "abc.txt" r]
     set file_data [read $fp]
     close $fp
     
     set data [split $file_data ".PGM"]
     foreach line $data {
          puts $data
      
     }



content of abc.txt is
/mvfs/fos-6000/build/swdl/cpp8548/freebsd/A9505026.PGM
/mvfs/fos-6000/build/swdl/cpp8548/freebsd/B9505026.PGM
/mvfs/fos-6000/build/swdl/cpp8548/freebsd/CPP05026.PGM


i want to read each line at a time and put it in a variable. please help
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File Handler in TCL

Hai , I Have Some x.txt file in which has the following data x.txt HI, How Are u r u fine /home/Sanju/samp.html /root/Sanju/design/sample now in tcl i have the following script set fp while { >= 0 } { puts $line ... (1 Reply)
Discussion started by: sanjustudy
1 Replies

2. UNIX for Dummies Questions & Answers

Reading line from file - TCL

I Have output of ps -ef in file. while reading from file, it reads one word but i want to read the full line. Is there any way to set IFS in TCL as we set in Shell. Thanks Ajay Kumar (2 Replies)
Discussion started by: aju_kup
2 Replies

3. Shell Programming and Scripting

TCL Reading file from Server

I'm nearly finished developing my app, im programming it in tcl/tk. I just need to get 1 last thing done. When my app starts, i ask the user for username and password. These are stored on a file on a unix server. My problem is how do i read a file from a unix server, i've tried everything but... (3 Replies)
Discussion started by: Phi01
3 Replies

4. Shell Programming and Scripting

TCL/Expect using puts to add data to a file

Hi all, I'm trying to do something that might be basic, but it is not working for me, and I suspect I'm missing something. I appreciate if you can shed a light or offer an alternative. In expect script, I'm opening a file i.e: set file I have a simple proc: proc a {} { puts "Hello... (3 Replies)
Discussion started by: ydekel
3 Replies

5. Programming

Parsing a text file in Tcl

Hi all, I need to parse through a text file searching for a specific string, then after I find this string read in remaining data off the line to a variable. I've tried various things and can't seem to get any to work. Any help would be much appreciated. (2 Replies)
Discussion started by: caboose57
2 Replies

6. UNIX for Advanced & Expert Users

File Format in TCL

Hi, Can anyone please guide me in writing a TCL script. I want to have a procedure to recreate an existing file and backup its copy and rename it by time of the updates are made. Eg: I have file xyz.tcl (which on recreation is saved as xyz_11jan_15_30_11.tcl) So when I do % ls... (1 Reply)
Discussion started by: mail2leo
1 Replies

7. Programming

File handling in TCL

Hi, I have n number of files in a directory with extension .PGM i need to store the full path name in a variable and only the file name with extension in another variable. Each time i'll be using the next file name for manipulation. Please help me out to do this using TCL thanks (1 Reply)
Discussion started by: Syed Imran
1 Replies

8. Shell Programming and Scripting

Need to call tcl function from other file !!

Hi, Can a function written in tcl in some other file be called in unix scripts ? Like this ? This is my code now--- shell.sh: #!/bin/bash tclsh snmpv2-conf-sam.tcl $SERVER $NODESYSIP $SPASSWD but i need this in a different way like , without having a .tcl file i want the... (2 Replies)
Discussion started by: giri_luck
2 Replies

9. UNIX for Beginners Questions & Answers

TCL script to insert some text on a file

Hi All , I am looking to create one TCL script to insert one text based on some regular expression match on one file as stated below Input File module (mem1 ,mem2 , bist1 , ten2 , sen1 , land2 , taane2 , ran1 , ran2 , tri2 , tri8 , fly1 , fly2 , san2 ); output ran1 , ran2 , tri2 ,... (1 Reply)
Discussion started by: kshitij
1 Replies
Libnetpbm manual(3)                                          Library Functions Manual                                          Libnetpbm manual(3)

NAME
libnetpbm - general introduction to the netpbm library DESCRIPTION
libnetpbm is a C programming library for reading, writing, and manipulating Netpbm images. It also contains a few general graphics manipu- lation tools, but it is not intended to be a graphics tools library. For graphics tools, Netpbm expects you to run the Netpbm programs. From a C program, the libnetpbm function pm_system() makes this easy. However, since it creates a process and execs a program, this may be too heavyweight for some applications. To use libnetpbm services in your C program, #include the pam.h interface header file. For historical reasons, you can also get by in some cases with pbm.h, pgm.h, ppm.h, or pnm.h, but there's really no point to that anymore. The libnetpbm functions are divided into these categories: o PBM functions. These have names that start with pbm and work only on PBM images. o PGM functions. These have names that start with pgm and work only on PGM images. o PPM functions. These have names that start with ppm and work only on PPM images. o PNM functions. These have names that start with pnm and work on PBM, PGM, and PPM images. o PAM functions. These also have names that start with pnm and work on all the Netpbm image types. o PM functions. These are utility functions that aren't specific to any particular image format. For new programming, you rarely need to concern yourself with the PBM, PGM, PPM, and PNM functions, because the newer PAM functions do the same thing and are easier to use. For certain processing of bi-level images, the PBM functions are significantly more efficient, though. libnetpbm has a backward compatibility feature that means a function designed to read one format can read some others too, converting on the fly. In particular, a function that reads a PGM image will also read a PBM image, but converts it as it reads it so that for program- ming purposes, it is a PGM image. Similarly, a function that reads PPM can read PBM and PGM as well. And a function that reads PBM, PGM, or PPM can read a PAM that has an equivalent tuple type. For each of the five classes of libnetpbm image processing functions, libnetpbm has in in-memory representation for a pixel, a row, and a whole image. Do not confuse this format with the actual image format, as you would see in a file. The libnetpbm in-memory format is designed to make programming very easy. It is sometimes extremely inefficient, even more than the actual image format. For example, a pixel that a PPM image represents with 3 bytes, libnetpbm's PAM functions represent with 16 bytes. A pixel in a PBM image is represented by a single bit, but the PNM functions represent that pixel in memory with 96 bits. See LibnetpbmUser'sManual(3) for the basics on using libnetpbm in a program. You can look up the reference information for a particular function in ThelibnetpbmDirectory(1) Before Netpbm release 10 (June 2002), this library was split into four: libpbm, libpgm, libppm, and libpnm. That's largely the reason for the multiple sets of functions and scattered documentation. netpbm documentation December 2003 Libnetpbm manual(3)
All times are GMT -4. The time now is 12:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy