Programming :: Reading Lines To An Array And Generate Dynamic Zenity List?

May 18, 2011

explanation what I want to do exactly:I have a textfile which looks for instance like this:

file.txt:
...
something=else to do

[code]....

View 14 Replies


ADVERTISEMENT

Programming :: Split String Into An Array/list Of Lines In C++?

Jun 4, 2010

How can i split a string like this,

Code:
This is my first line.
This is my second line.
This is my third line.
into,

Code:
"This is my first line.", "This is my second line.", "This is my third line."
in C++.

i.e. split the code at every new line

View 11 Replies View Related

Programming :: Use Zenity In A Bash Script To Display A .csv File Using '--list'?

Jul 22, 2010

I'm trying to use zenity in a bash script to display a .csv file using '--list' to allow the user to edit some of the values.I can display it fine but i'm unsure how to edit the data? all i can get is whichever line is highlited when hitting ok on the zenity dialog to print.the data in the csv is arranged:

<prod>,<disc>,<qty>,<type>,<location>

View 1 Replies View Related

Programming :: C/C++ Dynamic String Array?

Mar 7, 2011

Can you create a dynamic string array and using calloc(),realloc()?
Like:

Code:
string* x;
x = (string) calloc(x,sizeof(string));

View 9 Replies View Related

Programming :: Make A Dynamic Array In C?

Feb 12, 2010

I was thinking about how to make a dynamic array in C, and I thought that it would be much better if it could accept any data type. Is this possible? Of course I thought about void pointers, but how do I store the actual data?

View 7 Replies View Related

Programming :: C++ Dynamic Array Of Struc Doubt?

Nov 28, 2008

I'm studing and making my first real life program in C++. I've got a doubt related with including a string type into a struct when I'm managing memory allocationdynamically.Bellow I copy the test program I did which works ok. But if I try to use string type instead of "const char *" into the struct I receive a "segment violation" error when I run the program. No error messages when compilling it.Does anybody knows if I'm doing something wrong?

#include <iostream>
using namespace std;
struct Datos {

[code]...

View 4 Replies View Related

Programming :: Reading Lines Within A File (Perl)?

Mar 16, 2011

I am trying to read certain lines within a file and give the output of the certain lines that dont equal my value, I think showing you would be easier. There is multiples of these inside one file...

Code:

LV Name /dev/vg00/lvol1
LV Status available/syncd
LV Size (Mbytes) 300lable/syncd

[code]....

I want to read everything in the file, if the status is not available then it should display the name (directly above status). If they are all availbale then do nothing. I think I know how to do it which includes putting the info in string form and placing in hash but it is proving to be out of my skill range.

View 12 Replies View Related

Programming :: Reading Specific Lines From A File?

Sep 10, 2009

To save on the writing of WAY to many files with very little in them, I want to put it all in one file and read a specific few lines. There will be six variables to be read at a time. Format is as such:

//Set 1
string name
5
12

[code]....

From name to 5th number is a set. The name will be of different lengths for each set. This will be a big file of probably 40+ sets. My problem lies in reading one and only one set be it set 5 or set 34. It needs to be done in C++.

View 2 Replies View Related

Programming :: Reading Text File Into An Array

Oct 20, 2010

I know that this is a really simple thing to do but I just can't figure it out. How do I read a text file into an array in C++?

View 3 Replies View Related

Programming :: Reading A File Of Data In An Array?

Feb 10, 2011

I have two files of data with different numbers of columns and rows. I want to read this two files in two arrays and then compare for example the second column of first data file with the third column of the other text file and if the difference between of two numbers is less than a threshold then the program print the information in the rows which fulfill this condition in the third text file. I have written below program but the problem is that it does not go through all rows of second file.

declare -a a
declare -a b
r=` awk '{n++} END {print n}' second.txt `
echo $r
awk '
{

[Code]....

Actually I have two data files one of them contains 44406 and the other one has 12066 rows and I want to check whether the difference between the components of two specific columns is less than a threshod but I have simplified it here. I had written this code and then I have realized that this code just goes through the number of rows as the same as the first.txt file and ignores the rest. I could not find the problem yet.

View 2 Replies View Related

Programming :: Dynamic List With Different Type - C++

Jun 26, 2010

I'm quite new to c++ programming, so my concepts are not so increased yet...

I wanna to create a list to store my objects. I'll resume them here:

Code:

private:

And what I want to do is an event list:

Code:

Sometimes this works and sometimes I got "segmentation fault".

I think I'm doing it wrong, cause these objects have different sizes, so I don't know if I could have all of them in a single array.

View 8 Replies View Related

Programming :: Bash - Reading Csv Delimited File To Array And For Further Manipulation?

Jan 6, 2010

I am trying to do this:

1. Read csv delimited file line1 and store all values in array

2. Use the values stored in the array and replace values in other text file with them

3. read line2 in the cvs file and repeat the process

4. Do above for all lines in the cvs file

for example:

file1.cvs content:

text1,text2,text3,"text 4"
a1,a2,3,"a 4"

file.txt content:

some text $array1$ some text
some text $array2$ some text

1. read line 1 - text1,text2,text3,"text 4" put each value in array X[] lines that contain spaces in cvs will have double quotes

2. read x[1] and replace value $array1$ (in file.txt) with x[1]read x[2] and replace value $array2$ (in file.txt) with x[2] and so on

Can above be accomplished in BASH and how?

View 1 Replies View Related

Programming :: Reading File Permissions Into Bash Array For Processing

Dec 1, 2010

I would like to read unix file permissions into a bash array for processing but tbh I have no idea how to do this. Then I will check for each individual access right l, d, x etc.

View 11 Replies View Related

Programming :: Modify Script Loading Array With Ranges Of Lines In Awk?

Mar 15, 2011

As awk programmers may know, we can print range of lines with awk, from an initial pattern until a final pattern as follow:

Code:

awk '/Initial_String/,/Final_String/' inputfile

Well, I have this inputfile:

Code:

[code]...

Once having those elements in that way within an array(a[]), I want to be able to manipulate the array (a[]) and copy its elements
to another array (b[]) in different order (all lines joined in a single line separated with commas), as follow:

Code:

Category,Adventure,Titles,Robinson,Crusoe,Saturday,Authors,Daniel-Defoe,Ian-McEwan

Only inserting the missing "array" coding and based and follow the code I've written Not needed to create a new code to do it with other method.

View 7 Replies View Related

Programming :: Reading In A Outside Text File And Putting In The String On That Line Into A Char Array That Is Already Allocated?

Mar 29, 2011

Here is the issue. I am reading in a outside text file and putting in the string on that line into a char array that is already allocated.

Code:
int main(int argc, char *argv[])
{

[code]....

View 1 Replies View Related

Programming :: List 10 Lines By Same In Bash?

Mar 30, 2010

I have a file witch I need to list 10 line by 10 lines with something like press enter to go on in between.
Well, the problem is that i have absolutely no idea on how to implement this.

Can you give me some points?

View 3 Replies View Related

Programming :: List String Indexes From An Array In Ksh?

Jan 24, 2011

How can I list string indexes from an array in ksh ?

View 4 Replies View Related

Programming :: Create An Array That Will Allow To Print A List After Selection?

Oct 18, 2010

I am trying to create an array that will allow me to print a list after selection such as:

1) Location A
2) Location B
3) Location C

Would you like to print selected locations? Print I have no idea how to approach this problem and don't know whether Perl, Bash or shell script would be the most useful in this particular situation.

View 5 Replies View Related

Software :: Dynamically Determining The Number Of Check List In Zenity?

Apr 29, 2009

In my project i cannot determine the number of check list initially. I will know dynamically during execution.How to specify the number of check list dynamically in zenity.

View 5 Replies View Related

Debian Multimedia :: Make A Dialog With Zenity Which Would Show An Updating List?

Jan 4, 2011

Is there a way to make a dialog with zenity which would show an updating list? Zenity does it with progress, but I didn't figure out if it's possible to do it with the list. I.e. for example, I want to monitor something, and update the dialog with new list periodically. Is it even possible? zenity can wait for data from stdin, but it just adds stuff to the list. May be there are some control sequences which clear the list in the dialog?

For example:

{ echo "Foo"; sleep 2; echo "Bar"; } | zenity --list --title='Dynamic list?' --text='Some data' --column='values'

How can I instead of adding Bar, replace the Foo with it?

View 2 Replies View Related

Server :: Remove Dynamic String Across Multiple Lines And Files?

May 13, 2011

My server was hit with an injection script which has placed code across many of my clients files. I need a script that can remove a block of php code that spans multiple lines, multiple directories/files and is dynamic, meaning that part of the code changes. I think using find/sed is what I need but cannot seem to figure out how to get it to work.The following is the script that is being injected everywhere. The catch is that they have generated dynamic code at the start/end of the script. (I have commented the parts that are dynamically changing on EVERY instance).PLEASE NOTE: Directly following this script is the start of a valid php script that I do not want to delete.

<?php
//{{65281980 - DYNAMIC!!
GLOBAL $alreadyxxx;

[code]...

View 2 Replies View Related

General :: Bash: Reading File Into Array?

Dec 2, 2010

I have a file named file.txt with the following contents

Code:

19 man
24 house
44 dyam
90 random

I want to read the file into array and store each line in each index. I've tried using the following code.

Code:

dataarray=($( < file.txt ))

It stores each word in each index rather than each line in each index.

View 3 Replies View Related

Ubuntu :: Reading Lines From File And Executing Scripts?

Jul 21, 2010

I am trying to create a script that reads a list of url's from a text file and then executes the same script for each line. This is what I am looking for:

elinks -dump $(url's in file, one by one) | grep "reply" > jobs.txt

View 6 Replies View Related

Programming :: How To Get Zenity Progress Bar Working Properly

Apr 14, 2011

I am busy writing this script to get a pixel count of a large batch of images in a directory for a research project. To do this I'm using a loop to get all the images in the directory. To make the whole procedure more user friendly for some colleagues I decided to use zenity, something I haven't yet really worked with. As not to make sure that the users don't have to watch to this blank screen during the actual processing of the images I'm trying to get the zenity progress bar working. So far the progress bar comes up but instead of changing over time it stays "empty" till all the images are processed and then becomes 100% when all images are done. What servers my needs for now, but since I am trying to learn more about zenity I was wondering how I could change the script to get the progress bar properly working? Below is the piece of script I am talking about.

Code:
cd $input #goto path of image directory
(for a in *jpg *JPG *jpeg *JPEG; do
if [ -f "$a" ]; then #was it a image file
b="$a" #set b to $a
convert -resize 1000x1000! ${b} -depth 1 -format %c histogram:info:$b.txt #get pixelcount and write to .txt file
fi
done) | zenity --progress

View 2 Replies View Related

General :: Reading Numbers From Text File And Storing In Array?

May 26, 2010

I'm writing a bash script where I read a text file (containing a column of numbers) and store each line in an array. There seem to be some problems with the whole thing however, but only for some files and not others. Here's what I do:

Code:
#!/bin/bash
file=time_notOk.txt ### The file with a column of numbers
i=0 ### Array counter
### Read the file

[Code]....

View 3 Replies View Related

Debian :: Generate Directory List With Exclusions?

Aug 18, 2011

I'm trying to generate a list of my music directory folder structure WITHOUT the files included. I have my music directory set up in a hierarchy of Artist>Album>Files, and I just want to generate a list of the folders because that will, in effect, output a list of what albums I have by what artists, which is ultimately what I'm after. I did some looking on the internet through various forums over the past few days and found two ideas that looked promising, but ended up being not exactly what I needed. The first was to generate a .txt file based off of a shell ls command:

ls -R [music directory name] >> ~/mymusiclist.txt

That's great, except that it also includes the 40,000+ individual music files by name. I'm not about to invest that much time editing the files out of the list when I know there has to be an easier way.The second idea I came upon involved using the extglob function. I tried enabling extglob and using it to input a "negative wildcard" into the above method to remove anything .mp3 from the returned list, but extglob didn't play well in that context. I'm not a command line wizard, so it's entirely possible that I'm missing something fairly obvious. In fact, I'm sure I am. So this is a great opportunity for me to learn something new. If anybody knows of a command line way to do this, I'd love to know it. Or, even better, if anybody knows of an app that can do this, even better. I'm not above installing a secondary music player just to import the library once and get my list.

View 3 Replies View Related

General :: Generate List Of All Available Man Pages On System?

Nov 5, 2010

How to generate a list of all available man pages on a system?

View 4 Replies View Related

Ubuntu :: Generate A List With Files And Folders?

Feb 2, 2011

if there is an application available to generate a list with files and folders from a location, like a hard drive or a folder? The list could be in any format, even a text file would be just fine.

View 3 Replies View Related

General :: Bash + Reading Values (numbers) From A File And Storing Them Into An Array?

Nov 4, 2010

I have to read a couple of numbers from a random.txt file. In this .txt file there are random numbers. They are separated by a space. Example if you opened test.txt:

test.txt :1 6 1 3 6 8 10 2 4

I would like to read those numbers using CAT and store them into an array:

numlen=${#num[*]} - (must be like this because it is a part of a larger program)

View 5 Replies View Related

General :: CLI Commands To Generate Random Result From Specified List?

Jul 20, 2011

List of 77 lines with the names of movies. For ease, let's say it's in a text file. What I want is a command line argument I can pass that'll read each line and pick one of those 77 lines at random, except I can't figure out how to do this. Is there a program I can just pipe the output of 'cat listofmovies.txt' to?

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved