Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. vodkadrinker

    listing commands hang

    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.
  2. vodkadrinker

    Windows display Little Endian text file

    I manged to get one on the c++ guys to take a look and it was not quite as simple as my inital program. But thanks for trying xwb
  3. vodkadrinker

    Windows display Little Endian text file

    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)...
  4. vodkadrinker

    Windows display Little Endian text file

    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...
  5. vodkadrinker

    Windows display Little Endian text file

    Thanks for your reply xwb, I was looking to do it within a c++ program as it is to be part of the output to a socket program I have.
  6. vodkadrinker

    Windows display Little Endian text file

    Should I be looking at the _wfopen?
  7. vodkadrinker

    Windows display Little Endian text file

    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?
  8. vodkadrinker

    Search for a string in a list element

    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...
  9. vodkadrinker

    Search for a string in a list element

    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
  10. vodkadrinker

    Search for a string in a list element

    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...
  11. vodkadrinker

    bash date validate

    Thanks feherke good to know the format option as well, handy for pattern matching things other than dates too.
  12. vodkadrinker

    bash date validate

    Found a quick way round this. if (date --date $mydatestring > /dev/null 2>&1); then
  13. vodkadrinker

    bash date validate

    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...
  14. vodkadrinker

    Deletion of none ascii char and null chars

    Thanks feherke works a treat and useful information on the alternation something I'm sure I'll use through out.
  15. vodkadrinker

    Deletion of none ascii char and null chars

    Is there and simple way to do these two commands in one? $logline =~ s/[^[:ascii:]]//g; $logline =~ s/\0//g;
  16. vodkadrinker

    Opening Large Files Question

    Now looking at "File::ReadBackwards.pm -- Read a file backwards by lines" This was exactly what I was looking for, posted solution to help others
  17. vodkadrinker

    Opening Large Files Question

    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...
  18. vodkadrinker

    Can sendmail be started by a non-root user

    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.
  19. vodkadrinker

    find ./ -mtime -7 -exec ls -l {} \;

    Change this:- find ./ -mtime -7 -exec ls -l {} \; To this:- find ./ -mtime 7 -exec ls -l {} \;
  20. vodkadrinker

    filename containing &quot; causing grief with script

    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/

Part and Inventory Search

Back
Top