Search Results

Search found 6758 results on 271 pages for 'shell exec'.

Page 78/271 | < Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >

  • Removing final bash script argument

    - by ctuffli
    I'm trying to write a script that searches a directory for files and greps for a pattern. Something similar to the below except the find expression is much more complicated (excludes particular directories and files). #!/bin/bash if [ -d "${!#}" ] then path=${!#} else path="." fi find $path -print0 | xargs -0 grep "$@" Obviously, the above doesn't work because "$@" still contains the path. I've tried variants of building up an argument list by iterating over all the arguments to exclude path such as args=${@%$path} find $path -print0 | xargs -0 grep "$path" or whitespace="[[:space:]]" args="" for i in "${@%$path}" do # handle the NULL case if [ ! "$i" ] then continue # quote any arguments containing white-space elif [[ $i =~ $whitespace ]] then args="$args \"$i\"" else args="$args $i" fi done find $path -print0 | xargs -0 grep --color "$args" but these fail with quoted input. For example, # ./find.sh -i "some quoted string" grep: quoted: No such file or directory grep: string: No such file or directory Note that if $@ doesn't contain the path, the first script does do what I want.

    Read the article

  • On Solaris, what is the difference between cut and gcut?

    - by Chris J
    I recently came across this crazy script bug on one of my Solaris machines. I found that cut on Solaris skips lines from the files that it processes (or at least very large ones - 800 MB in my case). > cut -f 1 test.tsv | wc -l 457030 > gcut -f 1 test.tsv | wc -l 840571 > cut -f 1 test.tsv > temp_cut_1.txt > gcut -f 1 test.tsv > temp_gcut_1.txt > diff temp_cut_1.txt temp_gcut_1.txt | grep '[<]' | wc -l 0 My question is what the hell is going on with Solaris cut? My solution is updating my scripts to use gcut but... what the hell?

    Read the article

  • Finding missing files by checksum

    - by grw
    Hi there, I'm doing a large data migration between two file systems (let's call them F1 and F2) on a Linux system which will necessarily involve copying the data verbatim into a differently-structured hierarchy on F2 and changing the file names. I'd like to write a script to generate a list of files which are in F1 but not in F2, i.e. the ones which weren't copied by the migration script into the new hierarchy, so that I can go back and migrate them manually. Unfortunately for reasons not worth going into, the migration script can't be modified to list files that it doesn't migrate. My question differs from this previously answered one because of the fact that I cannot rely on filenames as a comparison. I know the basic outline of the process would be: Generate a list of checksums for all files, recursing through F1 Do the same for F2 Compare the lists and generate a negative intersection of the checksums, ignoring the file names, to find files which are in F1 but not in F2. I'm kind of stuck getting past that stage, so I'd appreciate any pointers on which tools to use. I think I need to use the 'comm' command to compare the list of file checksums, but since md5sum, sha512sum and the like put the file name next to the checksum, I can't see a way to get it to bring me a useful comparison. Maybe awk is the way to go? I'm using Red Hat Enterprise Linux 5.x. Thanks.

    Read the article

  • How to provide metadata tags,keywords to Windows and fill properties page for a custom file format?

    - by Mode
    Hi, My application uses its own file format (compressed SQLite databases) to store user created data. 1) I would like to know how to provide keywords, tags to Windows so that Vista search function can include my file format when indexing. 2) I would like to provide a properties page like you see when you right click a Microsoft Word document and select properties. Kindly point me in the right direction. Thank you.

    Read the article

  • grep a rar in cygwin

    - by Tomer
    Hi, I want to do grep texts files inside a rar without extracting the rar file to disk, I tried a couple of combinations with pipes however it didnt work i tried for example unrar e myrar.rar | grep mysearchedline however it actually opened it to disk, I don't want to open it to disk, I don't have enough space for it to be opened (its real big with real big logs). Thanks.

    Read the article

  • How do I find the current virtual terminal

    - by camh
    I am working around a problem in Ubuntu 10.04 where after resume, the mouse cursor disappears. This can be "fixed" by running chvt 1; chvt 7 in a script in /etc/pm/sleep.d, such that those commands run on thaw and resume. However, the X console is not always vt #7, so chvt 7 is wrong in those cases. What I would like to do is find out the current vt in the fix-up script and make sure I change back to that vt. How can I find the current vt? (tty(1) just reports "not a tty")

    Read the article

  • Linux script to kill process listening on a particular port

    - by Evgeny
    I have a process that listens on a TCP port (?0003). From time to time it crashes - badly. It stops working, but continues hogging the port for some time, so I can't even restart it. I'm looking to automate this. What I do right now is: netstat -ntlp |grep -P "\*\:\d0003" To see what the PID is and then: kill -9 <pid> Does anyone have a script (or EXE for that matter) that would link the two steps together, ie. parse the PID from the first command and pass it to the second?

    Read the article

  • appending text to all files that starts with a string

    - by learner135
    How do I append a string to all the files in a directory that starts with a particular string? I tried, cat mysig >> F* But instead of appending contents of mysig to all files starting with F, it creates a file named "F*". Obviously wildcard doesn't seem to work. Any alternatives? Thanks in advance. Edit: Also how do I delete this newly created file "F*" safely?. Using rm F* would delete all the files starting with F which I wouldn't want.

    Read the article

  • Unexpected variable update when using bash's $(( )) operator for arithmetic

    - by philo
    I'm trying to trim a few lines from a file. I know exactly how many lines to remove (say, 2 from the top), but not how many total lines are in the file. So I tried this straightforward solution: $ wc -l $FILENAME 119559 my_filename.txt $ LINES=$(wc -l $FILENAME | awk '{print $1}') $ tail -n $(($LINES - 2)) $FILENAME > $OUTPUT_FILE The output is fine, but what happened to LINES?? $ wc -l $OUTPUT_FILE 119557 my_output_file.txt $ echo $LINES 107 Hoping someone can help me understand what's going on.

    Read the article

  • Calling a WPF Appliaction and modify exposed properties?

    - by Justin
    I have a WPF Keyboard Application, it is developed in such a way that an application could call it and modify its properties to adapt the Keyboard to do what it needs to. Right now I have a file *.Keys.Set which tells the appliaction (on open) to style itself according to that new style. I know this file could be passed as a command line argument into the appliaction. That would not be a problem. My concern is, is thier a way via a managed environment to change the properties of the executable as long as they are exposed properly, an example: 'Creates a new instance of the Keyboard Appliaction Dim e_key as new WpfAppliaction("C:\egt\components\keyboard.exe") 'Sets the style path e_key.SetStylePath("c:\users\joe\apps\me\default.keys.set") e_key.Refresh() 'Applies the style e_key.HideMenu() 'Hides the menu e_key.ShowDeck("PIN") 'Shows the custom "deck" of keyboard keys the developer 'Created in the style appliaction. ''work with events and resposne 'Clear the instance from memory e_key.close e_key.dispose e_key = nothing This would allow my application to become easily accessible to other Touch Screen Application Developers, allowing them to use my key_board and keep the functionality they need. It seems like it might be possible because (name of executable).application shows all the exposed functions, properties, and values. I just have never done this before. Any help would be appreciated, thank you in advance.

    Read the article

  • Getting Emacs ansi-term and Zsh to play nicely

    - by mronge
    I've been trying to use Zsh within my emacs session, without emacs remapping all the Zsh keys. I found ansi-term works pretty well for this but, I'm still having some problems. I was getting lots of junk characters outputted with, I was able to fix it with: ## Setup proper term information for emacs ansi-term mode [[ $TERM == eterm-color ]] && export TERM=xterm But everything still doesn't work perfectly. Now I am having trouble with output being drawn offscreen , especially when using something like C-r for search. Any thoughts. Anyone else have Zsh + Ansi-term working properly?

    Read the article

  • Bash: any command to replace strings in text files?

    - by mikez302
    I have a hierarchy of directories containing many text files. I would like to search for a particular text string every time it comes up in one of the files, and replace it with another string. For example, I may want to replace every occurrence of the string "Coke" with "Pepsi". Does anyone know how to do this? I am wondering if there is some sort of Bash command that can do this without having to load all these files in an editor, or come up with a more complex script to do it. I found this page explaining a trick using sed, but it doesn't seem to work in files in subdirectories.

    Read the article

  • BASH: Checking for environment variables

    - by Hamza
    Hi folks, I am trying to check the value of an environment variable and depending on the value do certain things and it works fine as long as the variable is set. When it isn't though I get a whole bunch of errors (as BASH is trying to compare the string I specify with an undefined variable, I guess) I tried implementing an extra check to prevent it happening but no luck. The block of code I am using is: #!/bin/bash if [ -n $TESTVAR ] then if [ $TESTVAR == "x" ] then echo "foo" exit elif [ $TESTVAR == "y" ] then echo "bar" exit else echo "baz" exit fi else echo -e "TESTVAR not set\n" fi And this the output: $ export TESTVAR=x $ ./testenv.sh foo $ export TESTVAR=y $ ./testenv.sh bar $ export TESTVAR=q $ ./testenv.sh baz $ unset TESTVAR $ ./testenv.sh ./testenv.sh: line 5: [: ==: unary operator expected ./testenv.sh: line 9: [: ==: unary operator expected baz My question is, shouldn't 'unset TESTVAR' nullify it? It doesn't seem to be the case... Thanks.

    Read the article

  • How do I rename a process on Linux?

    - by jemfinch
    I'm using Python, for what it's worth, but will accept answers in any applicable language. I've tried writing to /proc/$pid/cmdline, but that's a readonly file. I've tried assigning a new string to sys.argv[0], but that has no perceptible impact. Are there any other possibilities? My program is executing processes via os.system (equivalent to system(3)) so a general, *NIX-based solution using an additional spawning process would be fine.

    Read the article

  • How can I terminate a multicast stream (asr - Mac) in a script?

    - by user355896
    Hello, I'm making a script to to run a bunch of multicast asr streams, but I do not know how to "stop" or "end" a multicast asr stream after a certain amount of time. Loop Suspend does not do what I'm looking for. I've also tried to add a sleep command followed by a kill command, but they kick in after the stream ends (so that approach does not work). Thanks for any possible help! By the way, I'm writing this script in bash.

    Read the article

  • How can I display different icons for same file extension

    - by ScottCate
    Visual Studio has *.SLN files for 2008, and 2010. In explorer, the icon associated with the file is based on the version somehow. I was always under the impression that the associated icon just looked at the extension, but obviously there is more going on. I'm asking on stack overflow as a developer - for my application, but if you feel this belongs on another forum, I'm happy to move the discussion elsewhere. Thank you!

    Read the article

  • KSH: Variables containing double quotes

    - by nitrobass24
    I have a string called STRING1 that could contain double quotes. I am echoing the string through sed to pull out puntuation then sending to array to count certain words. The problem is I cannot echo variables through double quotes to sed. I am crawling our filesystems looking for files that use FTP commands. I grep each file for "FTP" STRING1=`grep -i ftp $filename` If you echo $STRING1 this is the output (just one example) myserver> echo "Your file `basename $1` is too large to e-mail. You must ftp the file to BMC tech support. \c" echo "Then, ftp it to ftp.bmc.com with the user name 'anonymous.' \c" echo "When the ftp is successful, notify technical support by phone (800-537-1813) or by e-mail ([email protected].)" Then I have this code STRING2=`echo $STRING1|sed 's/[^a-zA-Z0-9]/ /g'` I have tried double quoting $STRING1 like STRING2=`echo "$STRING1"|sed 's/[^a-zA-Z0-9]/ /g'` But that does not work. Single Qoutes, just sends $STRING1 as the string to sed...so that did not work. What else can I do here?

    Read the article

  • xargs command works on ubuntu, but not mac

    - by Corey Hart
    I have the following line of code that I use to update my personal date variable in my projects to todays current date. This line works in Ubuntu's terminal, but the Mac terminal seems to be far behind. Unfortunately, I copied this snippet from some site, so I'm not sure how it exactly works. Suggestions? grep -ilr --exclude=revar.sh --exclude=README.md "[DATE]" * | grep -v .git | xargs -i@ sed -i "s/\[DATE\]/${today}/g" @

    Read the article

  • Windows7 explorer context strip hook?

    - by aceman
    Hy everybody, I'm wondering if it's possible to add a new button via C++ or C# to windows 7 explorer "context strip"(don't know if this is correct name) - like on picture below. My reason for this is because a lot of times I'm switching on&off "Show hidden files, folders and drives" functionality under Tools-Folder option-View. Therefore i want to simplify this process with a click of a button. I was looking into ShellExecteEx function, but I am not sure I can do that. Can Anybody direct me in right direction? thanks, regards

    Read the article

< Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >