Tag Info

New answers tagged

0

Use a little utility called mmv. You can uppercase the first letter as follows: mmv "[a-z]*\.*" "#u1#2.#3" And for the second case you mention (MY_log.php), you could solve this as follows: mmv "*_[a-z]*.php" "#1_#u2#3.php" or: mmv "*_[a-z]*" "#1_#u2#3"


0

With Bash 4, first enable additional globbing options: shopt -s extglob Now make sure you call this only in the folders that contain the PHP files you want to rename. It will recursively look for .php files. for f in **/*.php; do fn=$(basename "$f") # remove directory name Fn=${fn^} # uppercase first letter echo mv -- "$f" "$(dirname ...


1

I created a PowerShell port for locate and updatedb. Uses SQLite as a backend, and has an auto installer. Just .\Invoke-Locate.ps1 -install. locates take about 300ms/query. Then locate whatever and you're set. https://gallery.technet.microsoft.com/scriptcenter/Invoke-Locate-PowerShell-0aa2673a


0

You can use the ampersand (&) after the command to put it in the background. If you want 3 instances of it running in the background, you could do the following: ./a.out& ./a.out& ./a.out& note it doesn't have to immediately follow the command, the following will do the same thing as well: ./a.out & ./a.out & ./a.out & You ...


0

No, the Windows Messenger service required for NET SEND functionality does not exist on Windows Vista, Windows 7, or Windows 8. The service is disabled by default on Windows XP SP2 and SP3. You'll need to use the MSG command instead.


1

atool is designed for this job. A copy of the man page is available here. To compress files use apack ARCHIVE FILE and to decompress them use aunpack ARCHIVE (alternatively you can use atool -a and atool -x respectively). It works with pretty much any archive format you can think of including gzip, bzip, lzip, 7z, rar, ar, deb, rpm, jar[1] and most ...


0

To handle XML, use proper XML handling tools. For example, xsh: cd //PlayList[Album='X1']/Group set . 'X3'


39

This does what you are looking for: find . -maxdepth 1 -type f -print0 | xargs -L1 -p0 chmod +x This uses find rather than ls because, generally, parsing ls output is unreliable. This form, using find, however, will work with filenames even if they contain newlines or other difficult characters. Explanation find . -maxdepth 1 -type f -print0 This ...


24

You can use xargs. eg: ls|xargs -I path -p chmod +x path Option -p: Prompt the user about whether to run each command line and read a line from the terminal. Only run the command line if the response starts with 'y' or 'Y'.


0

After struggling for a couple of hours, I solved it by myself. I'll post the solution here, just in case: # Creates an empty disk image of 256MB, creates its GPT, and then it makes # two partitions: the first one of approximatively 60MB, the second one fills # the remaining bytes. Both partitions are aligned. dd if=/dev/zero of=disk.img bs=1M count=256 ...


1

Been wanting this a long time! :) Just wanted to +1 idea of using AHK, and suggest an improvement to the script for it. I like ^W for word erase, as in linux shells, so I'm glad to have found this. The first script didn't work for me in CMD (jumps back a word then erases the first character, not the whole word). The next script above wasn't quite ideal ...


0

Finally found the actual issue: there was a " in the PATH environment variable. Everything after " was ignored when trying to run executables from cmd.exe, although the where command could still find them.


0

One of the way to restrict the possibility to execute commands is the restricted shell. Excerpt from the manual, where is said that the following are disallowed or not performed: Changing directories with the cd builtin. Setting or unsetting the values of the SHELL, PATH, ENV, or BASH_ENV variables. Specifying command names containing slashes. Specifying a ...


0

Here'a my attempt to summarize built-in capabilities windows for compression and uncompression - http://stackoverflow.com/questions/28043589/how-can-i-compres-zip-and-uncopress-unzip-files-and-folders-with-batch-f with a few given solutions that should work on almost every windows machine. As regards to the shell.application and WSH I preferred the ...


0

Both xcopy and robocopy will do the job, but robocopy's output is closer to what you described. xcopy src dst /i /e /f /v /c > log.txt /F will output the full source and destination paths. /V is claimed to verify the file sizes, but doesn't print them in the output. Apart from not having the file sizes logged, this mostly achieves what you ...


0

After some finagling I've found the formula that works. FOR /f "tokens=1" %%g in ('"%TFEXE%" history . /r /noprompt /stopafter:1 /Version:W ^| findstr /R ^[0-9][0-9]*') do set TFS_BUILD=%%g The question I have is why would quoting the regex in findstr cause the entire operation to fail. None the less, it works for me and I'm posting it for anyone else to ...


1

DavidPostil is right in that you have to enclose the entire data string in double quotes, and then escape and double quotes inside the string to ensure it knows they are part of the string. In this case the entire data string you want to add is: xb'BV5!!!!!!!!!MKKSkEXCELFiles>VijqBof(Y8'w!FId1gLQ /dde /p "C:\Program Files (x86)\Microsoft ...


2

Reference Syntax : Escape Characters, Delimiters and Quotes Escape Character ^ Escape character. Adding the escape character before a command symbol allows it to be treated as ordinary text. When piping or redirecting any of these charcters you should prefix with the escape character: & \ < > ^ | e.g. ^\ ^& ^| ^> ...


3

Use the command in this way instead: PsExec.exe -u [domain]\[username] -p [password] \\[Machine Name] cmd For some reason, PsExec tries to start "PsExeSVC" on the remote computer using your local credentials instead of the domain credentials specified hence "access is denied". On the other hand, when you specify the credentials first, it works as ...


0

I use Caffine to keep my Mac awake. You can set it for a specific time period. Then have it stop, or shut down your computer.


1

From bash(1): The order of expansions is: brace expansion, tilde expansion, parameter, variable and arithmetic expansion and command substitution (done in a left-to-right fashion), word splitting, and pathname expansion. I.e., it does tilde expansion before variable expansion, so it doesn’t replace $user_variable with $1 (which, I assume, is ...


1

ls | awk '/^xyz/' Your original solution was just missing the ^ in the regep, which anchors the match to the beginning of the line. You don't need a print block because the default action when finding a match is to print the line. If you want to be explicit, you could write: ls | awk '/^xyz/ {print $0}' You should use $0 rather than $1 in case the ...


0

I experienced the same problem with ChefDK. The cause was an un-parseable value in my knife.rb. I had copied my config from a Windows workstation to Mac. So my cookbook path of c:... made no sense and all config values (including pem path) were ignored.


1

Possible reasons for Windows cmd shell error 'foo' is not recognized as an internal or external command, operable program or batch file Two environment variables are close bound with shell command execution: PATH and PATHEXT. The PATH environment variable defines the Windows search path, i.e. a list of directories that are searched when the command ...


2

Don't parse ls! You want awk '...' xyz* If, for some very odd reason, you want to do this entirely within awk: awk 'FILENAME ~ /^xyz/ { .... }' *


1

no need for awk. just use filename glob: ls xyz* most likely you will want to pipe the filenames to work on them? like this maybe? ls xyz* | some other commands in that case it is better to use a for loop. for filename in xyz* do some other commands "$filename" done note that in the first variant the filenames will come as a stream to stdin of ...


0

A simple one-liner can help you: perl -nE '$count++ if /192.168.2.16/;END{say $count}' your_file_name_here Run this one-liner from the command prompt. This will print the number of occurrences of 192.168.2.16 (so two occurrences on the same line will be counted twice). If you only want to count the lines where the address occurred at least once, use this ...


0

Use perl instead of sed perl -pe 's/,(?=\d{3}(?![.]))//g' replace comma (followed by tree digits with no trailing a decimal point) with nothing. Oh, just saw you also want the spaces trimmed perl -pe 's/,[ ]+/,/g;s/,(?=\d{3}(?![.]))//g'   This should be used in the framework in place of 'sed', like #!/bin/sh while true do clear date curl ...


0

What you are getting from Yahoo! is data in CSV-format. The format is too complex for bash (or even sed or awk) to properly parse in a one-liner. (Being full Turing-machine capable, any of the tools can do it, it will just not be pretty.) Your immediate problem with the above script is that sed is not given any input to work on, so your script hangs (after ...


1

I think I've got a solution for you.... cd desktop/quoteUpdate while true do curl -s "http://download.finance.yahoo.com/d/quotes.csv?s=goog,aapl,avxl&f=nsj2l1"|sed -e 's/,/_/1' -e 's/,/_/1' -e's/\(.*\),/\1_/' -e 's/,//g' -e 's/_/,/g' > quotes.txt echo UPDATED: date sleep 5 done done Give that a try.... You can append data to your ...


0

From the top of my head this ugly solution should do the trick. Replace your sed line by the following: awk 'BEGIN{FS="\"";OFS="\"";}{gsub(",","",$5);$5=","$5;print $0}' quotes.txt > UPDATED_quotes.txt I'll update this post if I find a more elegant answer.


0

This is because of following reason: First of all, most linux commands support parameters by using following function : getopt() and getopt_long(). getopt() was used to support single character with an "-" to distinguish various options The long option i.e getopt_long() (ex : --help) is a GNU extension that provides more readability and also ...


0

The settings are stored in the registry. So you have to export the registry key specific to this program's location, then import it on the new pc. It is stored here: HKEY_CURRENT_USER\Console\<name of program>


2

The simplest construction would be: (command1 ; command1.1) | command2 | command3 There are two potential problems with this. If command1.1 produce any output on stdout, it will be sent through the pipe. Additionally command2 will not see EOF on stdin until command1.1 has completed. If the pipeline is initially invoked in a context where stdout and ...


1

I told you that this would be quick once you asked the question properly. You state that you are running cd $TMP in Microsoft's command interpreter, cmd. That is not the syntax used for environment variable expansion in Microsoft's command interpreter. The syntax is cd %TMP%. Yes, the trailing percent sign is important.


3

You can redirect it to a subshell. command1 & > >(command2 | command3) & wait $! # Wait end of process $! (actually the pid of command1) command_1.1 Another way is to create a named pipe fifo. A script should be similar to MYFIFO=/tmp/myfifo.$$ rm -f $MYFIFO mkfifo $MYFIFO command1 > $MYFIFO & MYPROGRAM_PID=$! cat $MYFIFO ...


1

CLI switches aren't the only thing that can control the behavior of the Windows processes. The process invocation via CLI and via Task Manager are actually quite different, and this footprint can be used in multiple ways. CWD (the answer) The reason why Explorer doesn't start task bar is that when executed from CLI, it's working directory is different ...


4

The important part about this is "after that" - the only concept UNIX pipes have of "after that" is, that they usually close, but they will execute after the first command has started, not after ist has ended. So what you need to do, is employ a shell script - something which does have the concept of "one after the other": echo 'command1' > myscript.sh ...


2

I'm afraid there is no rule: blame history. Originally DOS and its predecessors used /?, while Unix used - as an option indicator, since / was a directory separator; since the shell could expand -? into a different string by file name expansion, -h became the norm. So far, so comparatively straightforward. In cmd many commands retain the /? convention, ...


1

cmd.exe measures font height as cell height. KiTTY measures font height as character height (which is smaller than a cell). ConEmu may use either cell or character heights according to setting (named "Treat font height as device units"). Also the real height may depends on your monitor dpi value (setting named "Admin monitor dpi with font size"). High-dpi ...


0

You will have to write your own binary to hex function ... cut -f2-8 -d' ' infile | tr -d '\n' | tr ' ' '\n' | while read l; do echo -n $(bin_to_hex($l)) >> outfile (( ++n )) (( n % 60 == 0)) && echo "" >> outfile done This should output the same format as -p which can then be run through -r. If you read the man page for ...


0

You alter the structure of the file do you can't easy do this. Maybe something like this can help (but you will loose newline characters: awk '{printf $8}' binary_format.txt >out_file


0

ctrl + z stopps the process. Try bash command fg to bring back the dialog to foreground when copy was done. This should continue execution of the stopped process.


3

I just as a test wrote echo before each line to get an idea of what it was doing. The %1 and %* are getting eaten up by the batch file as it replaces them with nothing. For Cmd like behaviour you need to use %%1 and %%* Try %%1 and %%*


2

There are several methods to delete a hosted network. Method 1 : Network and Sharing Center Right click on the Network icon in the notification area () and choose "Network and Sharing Center". In the Network and Sharing Center windows, click on "Change Adapter settings", to see all of your network connections. This will look like: Select the Hosted ...


0

I want to provide a somewhat more concise and clearer answer. I'm afraid there is no way to create MP3 files that consistently play back without gaps at the start and end. This is known as Gapless Playback and is a much discussed problem. As at least one of the other answers says, there are workarounds that work with some specific music players.


0

I would cehck that you are 100% sure you don't need admin rights on windows 8.1. The list of actions which require admin rights has been extended in windows 8.1 and can include a lot of things: Allowing a process to write to the root of C:, C:\windows, C:\Program Files (and x86) Write to the Registry Write to the all users start menu/desktop Write to ...


0

See this word cloud generator written in Python: https://github.com/amueller/word_cloud


2

Shame on Yahoo for invalid CSV $ cat quotes.csv "Google Inc.","GOOG",501.79,+0.92,"+0.18%", 678,365,000,26.36 "Apple Inc.","AAPL",106.86,-2.94,"-2.68%", 5,864,839,000,17.02 $ sed 's/[[:blank:]]*\([[:digit:],]\+\)\(,[[:digit:].]\+\)/"\1"\2/' quotes.csv "Google Inc.","GOOG",501.79,+0.92,"+0.18%","678,365,000",26.36 "Apple ...


0

If you use your original script and add setlocal enabledelayedexpansion you can replace %start% and %end% by !start! and !end! and your script will work as you intended. Your script doesn't allow for blanks in the file names, so I propose the following modified script:- echo off setlocal enabledelayedexpansion cd \ set start= set end= set paths= type ...



Top 50 recent answers are included