Bash: Reading out rows of a file into a dynamic array and check first literal
Hello,
i have a file "Movie.ini" looking e.g. like follows
I'd like to read the file "Movie.ini" with cat and grep and check whether it includes the string MOVIE only with a '*' at the beginnig.
By doing
all rows containing MOVIE should be saved in a tempfile
I have following problem, since I just know a bit ksh but not bsh:
1. How can I read out the rows of the file "tmp_MOVIE" in a VARIABLE long / dynamic allocated array? (Since there is NOT a fix number of rows containing the string MOVIE - it can be 3, 5 or e.g. 20)
2. How can I check the first literal of an array-element whether it is a '*'?
Thanks a lot for any helpful answer
Please use CODE tags next time when displaying code, data or logs to enhance readability and to preserve formatting like indention etc., ty.
Last edited by zaxxon; 07-31-2009 at 12:37 PM..
Reason: code tags
Hi guys i had a script which will generate a log file.Is there any commands to check the dynamic changes in the log file,i.e if i open the log file i should able to see the updating changes live...I hope u understand my query... (2 Replies)
I am facing a strange error while creating posix threads:
Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output.
Snippet 1
This works:
--------------
int *threadids;
threadids = (int *) malloc (num_threads * sizeof(int));
... (4 Replies)
I have a file that is a text file, how to get all the words into and array, i am able to get each line but not each word :(.
Here is what i searched and already found...https://www.unix.com/shell-programming-scripting/99207-pipe-text-file-into-array.html.
This one reads a whole line into... (6 Replies)
I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value.
I was thinking the best way to... (1 Reply)
I need some help with this code below, i doesnt know why it will run twice with my function, but my function only got if else, any other way that can read line and put into array?
while read line; do
read -A array <<<$line
n=${#array}
for ((i=1;i<$n;i++)); do
print... (1 Reply)
Hi,
I need to read a file into array and print them in a loop:-
1st file :-cat a.txt
RC1
RC2
RC3
RC4
My Program:-
#!/bin/ksh
index=0
while
do
read cnt<a.txt
print "cnt value is ${cnt}
index=`expr $index + 1`
done
Code tags for code, please. (5 Replies)
Hi I have a file with contents as below :
server | ABC Issue : File System Missing XYZ Issue : Wrong Syntax PQR Issue : Old File to be removed
Now I am looking for an o/p similar to
server <tab> ABC Issue : File System Missing
<tab> XYZ Issue : Wrong Syntax
<tab>... (4 Replies)
First of I would just like to state that I am not looking for you guys to just do my work for me, I do want to learn and actually understand everything that is happening.
Hey all, I am having trouble on this. What I need to do is... Write an executable C file that will take a text file (not a... (8 Replies)
I am trying to identify all messages or prompts from a number of COBOL programs and they can usually be identified by a pair of double quotes on one line. However, sometimes the literal will not be finished on the first line but after a dash in column 7 of the next line, the literal will be... (6 Replies)
Hi Folks,
I have a requirement to develop a shell script. PFB my requirement,
Requirement:
I need to check an empty line after the end of each header in respective file and if a empty line is present simply echo file OK and if empty line is not present echo "Adding empty line" and add an... (6 Replies)
Discussion started by: tpk
6 Replies
LEARN ABOUT DEBIAN
xkbaddgeomoverlay
XkbAddGeomOverlay(3) XKB FUNCTIONS XkbAddGeomOverlay(3)NAME
XkbAddGeomOverlay - Add one overlay to a section
SYNOPSIS
XkbOverlayPtr XkbAddGeomOverlay (XkbSectionPtr section, Atom name, int sz_rows);
ARGUMENTS
- section
section to which an overlay will be added
- name name of the overlay
- sz_rows
number of rows to reserve in the overlay
DESCRIPTION
Xkb provides functions to add a single new element to the top-level keyboard geometry. In each case the num_ * fields of the corresponding
structure is incremented by 1. These functions do not change sz_* unless there is no more room in the array. Some of these functions fill
in the values of the element's structure from the arguments. For other functions, you must explicitly write code to fill the structure's
elements.
The top-level geometry description includes a list of geometry properties. A geometry property associates an arbitrary string with an
equally arbitrary name. Programs that display images of keyboards can use geometry properties as hints, but they are not interpreted by
Xkb. No other geometry structures refer to geometry properties.
XkbAddGeomOverlay adds an overlay with the specified name to the specified section. The new overlay is created with space allocated for
sz_rows rows. If an overlay with name name already exists in the section, a pointer to the existing overlay is returned. XkbAddGeomOverlay
returns NULL if any of the parameters is empty or if it was not able to allocate space for the overlay. To allocate space for an arbitrary
number of overlays to a section, use the XkbAllocGeomOverlay function.
STRUCTURES
typedef struct _XkbOverlayRec {
Atom name; /* overlay name */
XkbSectionPtr section_under; /* the section under this overlay */
unsigned short num_rows; /* number of rows in the rows array */
unsigned short sz_rows; /* size of the rows array */
XkbOverlayRowPtr rows; /* array of rows in the overlay */
XkbBoundsPtr bounds; /* bounding box for the overlay */
} XkbOverlayRec,*XkbOverlayPtr;
SEE ALSO XkbAllocGeomOverlay(3)X Version 11 libX11 1.5.0 XkbAddGeomOverlay(3)