Listing commands hang but work fine when piped through more.
This hangs:-
ls -ltr
This works:-
ls -ltr|more
This issue rings a bell but I cannot remember the solution.
He is some example code of how I can do it with the iconv command:-
#include <stdio.h> /* printf */
#include <stdlib.h> /* system, NULL, EXIT_FAILURE */
int main ()
{
int i;
setvbuf(stdout, (char*)NULL, _IONBF, 0);
printf ("MyFile\n");
setvbuf(stdout, (char*)NULL, _IONBF, 0)...
Hi basically the socket program all programs in a directory and the output is from the program is displayed to the socket when a connection is made.
To simplify what I am trying to do if the file wasn't Unicode LE type I could just run the system command, type myfile.txt and that would be ok...
I would like to output the contents of a Little Endian text file.
I thought this was quite a simple task but it seems to be not that straight forward, from a Unix point of view I would just use the iconv command does Windows have a similar command or a simple way to do this?
Found the answer to the problem, when there is a space in the file/directory name it splits the elements.
So the list is being seen as
['/home/myfiles/abc.bob/a','file']
Instead of
['/home/myfiles/abc.bob/a file']
Thanks for your help Bob, as it helped me to look deeper into the problem and...
Thanks Bob now I know this should work, I will check back through.
Funny enough if I add a total line count it gives me the correct number of lines.
for line in info:
total_count += 1
if 'abc.bob' in line:
abc_count += 1
I am trying to find a string in a list element.
example data
'/home/myfiles/abc.bob/a file'
'/home/myfiles/abc.bob/b file'
'/home/myfiles/bbb.bob/a file'
So from the data I want to find any line with "abc.bob" and then just count the number of them.
The data is read into a list called...
I am writing a simple script in bash so that it is easily portable, is there an easy way to validate a string is a date?
Example
My string should come back in the format "2013-03-07" CCYY-MM-DD however it may be blank or anything, if it's not in a date format then I would like to ignore it...
I am currently looking at opening large files, wondered if someone could answer a query.
open (FILE, '<', $file) or die "$!\n";
while (<FILE>) {
*Do stuff with line
}
a) When you use "open" does this read the whole file in before I start reading line by line?
b) If it does open the whole file...
You can use sudo to allow users to run commands as root, so thats probably your easiest route.
Create a new user specifically for the scom and then setup the sudo to run commands that you would normally as the root user.
What about this to save editing the file directly, sed replacing all " with \":-
ls | grep blah | sed 's/\"/\\\"/g' > blah.txt
cat blah.txt | xargs -i mv "{}" archive/
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.