Sponsored Content
Top Forums Shell Programming and Scripting plugging out value from a textfile Post 302103433 by radoulov on Thursday 18th of January 2007 10:11:56 AM
Old 01-18-2007
Or with bash (and ksh93?):

Code:
a=($(<filename.txt))
var1="${a[1]}"
var2="${a[3]}"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding overwriting the textfile with output what we get!

Hi freinds, My problem is I have a script which is used for our office work... in that with my userid i can append the LOGFILE with the output which i get while running the script.. for this i use the below command output >> $LOGFILE but with the same script my colleague is... (6 Replies)
Discussion started by: smarty86
6 Replies

2. Shell Programming and Scripting

manipulate the textfile having strings

i have text files named like vho1.txt, vho2.txt... vho15.txt.In all there are 15 in number. each file has strings like \Movies On Demand\Action & Adventure|X-Men: Wolverine|2009-09-29 00:01:00|2010-03-24 23:59:00|Active|3 \Movies On Demand\Free\Free1|My movie 14|2010-01-11 00:00:00|2010-03-01... (5 Replies)
Discussion started by: ramse8pc
5 Replies

3. Shell Programming and Scripting

Textfile lesson

Tag allerseits Ich habe ein umfangreiches Script. Darin möchte ich zu Beginn ein textfile lesen. Den ersten Satz. Dann kommen mehrere Instruktionen und dann soll wieder gelesen werden. Den zweiten Satz. Etc. Ich kann also das herkömmliche while read xyz / do ... done nicht benützen. ... (0 Replies)
Discussion started by: lazybaer
0 Replies

4. Shell Programming and Scripting

Auto-executing a script by plugging in a USB Stick - How?

I have a script. And I want it to be executed whenever I plug in my stick in my PC or in other PCs. I have heard about udev rules but they doesn't suit me, i have to do the same thing in more of 6 PCs - tiring. So, is there any way to auto-execute a script when the USB is plugged in?:confused: (6 Replies)
Discussion started by: hakermania
6 Replies

5. Shell Programming and Scripting

How to extract more than 1 line in a textfile ?

Hi, I'm starting a little project with a shell script but I'm don't know how to do it. Maybe someone can help me. I have un text file like this : I'd like to do a script who will extract from my file from @ADDLINE1@ to @ADDLINE4@ only and I have no idea how to do this. Any idea ? ... (7 Replies)
Discussion started by: Poulki
7 Replies

6. UNIX for Dummies Questions & Answers

Creating textfile from arguments

Hi all I'm new to this forum and I really hope someone can help me out with a (for you guys) fairly easy question. I want to have a script that takes 1-14 arguments, all numbers 1-14, say myscript 1 3 4 5 7 what the script shall do is basically generare a textfile that contains 16... (5 Replies)
Discussion started by: Tobbev
5 Replies

7. Shell Programming and Scripting

Change value in a textFile

Hi everyone, I need to make a script to take three parameters: -> KEY -> NEW_VALUE -> FILE The FILE is a text plane file. The KEY is a variable to configure, for example: KEY1 = HOLA KEY2= HOLA KEY3=HELLO KEY4 =HOLA And the... (4 Replies)
Discussion started by: Xedrox
4 Replies

8. Windows & DOS: Issues & Discussions

Use Textfile for variables ?

So... I have a text file that contains this (hex.txt): #8C7CA6 #6C70A5 #75777C #959A90 #7A7C6C #867DAB #80867E #8A87BD #6B71C6 #8F8A79 #9A9DCE #7E87D0 #69709E #82968C #7C8F81 #A3917B (5 Replies)
Discussion started by: pasc
5 Replies

9. Shell Programming and Scripting

How to separate sorte different characters from one textfile and copy them in a new textfile?

My first post, so don't kill me :) Say i open some textfile with some example like this. on the table are handy, bread and wine Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this: table plane ... (3 Replies)
Discussion started by: schwatter
3 Replies

10. Shell Programming and Scripting

Variablecontent in a Textfile

I want to save a variablecontent in a Textfile. How can i do that? These works only with ls shell_exec("ls > text.txt");Please use code tags, thanks (2 Replies)
Discussion started by: Linuxmann
2 Replies
ppmtoxpm(1)						      General Commands Manual						       ppmtoxpm(1)

NAME
ppmtoxpm - convert a portable pixmap into an X11 pixmap SYNOPSIS
ppmtoxpm [-name=xpmname] [-rgb=rgb-textfile] [-alphamask=pgmfile] [ppmfile] Minimum unique abbrevations are acceptable. DESCRIPTION
Reads a portable pixmap as input. Produces X11 pixmap (version 3) as output which can be loaded directly by the XPM library. For example, to convert the file "dot" (found in /usr/include/X11/bitmaps), from xbm to xpm one could specify xbmtopbm dot | ppmtoxpm -name dot or, with a rgb text file (in the local directory) xbmtopbm dot | ppmtoxpm -name dot -rgb rgb.txt OPTIONS
-name=xpmname The -name option allows you to specify the prefix string which is printed in the resulting XPM output. If not specified, will default to the filename (without extension) of the <ppmfile> argument. If you do not specify -name or ppmfile, (i.e. your input is from Standad Input), the prefix string defaults to the string noname. rgb=rgb-textfile The -rgb option allows you to specify an X11 rgb text file for the lookup of color name mnemonics. This rgb text file is typically the /usr/lib/X11/rgb.txt of the MIT X11 distribution, but any file using the same format may be used. When specified and a RGB value from the ppm input matches a RGB value from the <rgb-textfile>, then the corresponding color name mnemonic is printed in the XPM's colormap. If you don't specify -rgb or if the RGB values don't match, then ppmtoxpm produces the color specifications in the #RGB, #RRGGBB, #RRRGGGBBB, or #RRRRGGGGBBBB hexadecimal format. -alphamask=pgmfile This option names a PGM file to use as an alpha (transparency) mask. The file must contain an image the same dimensions as the input image. ppmtoxpm marks as transparent any pixel whose position in the alpha mask image is at most half white. If you don't specify -alphamask, ppmtoxpm makes all pixels in the output opaque. ppmcolormask is one way to generate an alpha mask file. You might also generate it by extracting transparency information from an XPM file with the -alphaout option to xpmtoppm. There are similar options on other Netpbm converters that convert from formats that include transparency information too. LIMITATIONS
An option to match the closest (rather than exact) color name mnemonic from the rgb text would be a desirable enhancement. Truncation of the least significant bits of a RGB value may result in nonexact matches when performing color name mnemonic lookups. SEE ALSO
ppmcolormask(1), xpmtoppm(1), ppm(5) XPM Manual by Arnaud Le Hors lehors@mirsa.inria.fr AUTHOR
Copyright (C) 1990 by Mark W. Snitily. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in sup- porting documentation. This software is provided "as is" without express or implied warranty. This tool was developed for Schlumberger Technologies, ATE Division, and with their permission is being made available to the public with the above copyright notice and permission notice. Upgraded to XPM2 by Paul Breslaw, Mecasoft SA, Zurich, Switzerland (paul@mecazh.uu.ch) Thu Nov 8 16:01:17 1990 Upgraded to XPM version 3 by Arnaud Le Hors (lehors@mirsa.inria.fr) Tue Apr 9 1991 Tue Apr 9 1991 ppmtoxpm(1)
All times are GMT -4. The time now is 11:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy