New answers tagged

0

A bit old I know, I wanted such a script: list files having a hyphen character find -iname '*-*.pdf' keep the part before the hyphen find -iname '*-*.pdf' | sed "s/-.*$//" remove duplicates: you have the prefixes you want ("John Doe", "Jane Smith") (you could ignore prefixes having only one occurences but this is probably not be required if the ...


2

Basically, you first search for matching files, extract their path and then delete the path. This will work: for /f "delims=" %%F in ('dir /b /s *.drt') do @if exist %%F rd /s /q %%~dpF The search command is just dir, the list is processed in a FOR loop, and the path extraction is done via %%~dp, i.e. only drive and path is extracted from each file ...


0

Perhaps Tcl/Tk ( www.tcl.tk ). Tcl is a scripting-language, and the Tk-extension to it lets you make GUIs pretty easily. There are online examples, and it's also mentioned in books like "Running Linux". (With Tcl you can also get expect, an extension that lets you create scripts that interacts with other programs, and contains challenge-response pairs... ...


0

I have figured out a solution. It's somewhat sloppy but it works.. Sub D55 '<Shortcut = Shift+Ctrl+D> On Error Resume Next With ActiveSession .InputMode = 1 Dim Orig As Currency Dim Rcvd As Currency Dim Rmng As Currency .SetSelection 56,6,64,6 .Copy .ClearSelection ...


0

The json file passed as argument to curl -d should be preceded by @ symbol. curl -X POST http://localhost:9200/tests/test -d @usr/share/elasticsearch/data/test.json


-1

Verify that the files are not Hidden or system files. If System try: forfiles -p "H:\SHARED\Scans" -s -m *.* -d -7 -c "cmd /c del /a-s @path" If Hidden Try: forfiles -p "H:\SHARED\Scans" -s -m *.* -d -7 -c "cmd /c del /a-h @path"


0

You can use find to get the input files, tail to get the end of the files, and sort to sort them. For example: find /path/to/ -name "file*.txt" -type f -exec tail -n1 {} \; | sort --numeric-sort --output output.txt Where /path/to/ is the path to your files, file*.txt is the pattern of your file names, -type f finds only files, not directories, -n1 tells ...


0

** I need a shell script to copy only ... last line of them into a single file and sort them from smallest to largest. Since your example files don't have a line 11, I have worked on the basis of your stated "(last line)". multiple text files with a common naming pattern. last line sort place in a file To gather the last lines and sort them $ tail ...


2

Depending on which you think is more consistent, the 11th line, or the last line, you could use either sed or tail, respectively. I would prefer sed as it handle multiple files more cleanly, and also ensures that files with fewer lines are included. So, then, you would just need a list of your files. This could be done with globbing, if they are all in the ...


0

Start Regedit.exe and select the HKEY_USERS branch. From the File menu, click Load Hive... Select the following file: C:\users\default\ntuser.dat Assign a Name for the loaded hive (eg. defaultuser) Browse to the Software\Microsoft\Internet Explorer\Main branch of the loaded hive, and make the modifications as required. Select the defaultuser hive. ...


2

If you're not able to use Group Policies to get this configured, then check these registry keys, create them if they don't exist, and adjust accordingly for your needs. Locate and then check the following three registry subkeys, and then change the values of the Default_Page_URL and Start Page entry to your desired website. HKEY_CURRENT_USER\...


1

Configuring the IE Home Page Solutions. . . Fortunately there are several workarounds for this issue. First, if you want to force users to use a particular home page for IE on their corporate users, you can use the following Group Policy setting to do this: Disable changing home page settings This policy setting is found under this ...


1

Expanding on grawity's great answer: First, to answer your question: Why does the batch script terminate when %CHECKCONTINUE% is given a null value? The problem is, in line 16, you do this: if %CHECKCONTINUE%==n GOTO exit Since CHECKCONTINUE is "undefined", it evaluates to an "empty" string, so the statement on line 16 is actually doing: if ==n GOTO ...


1

The easiest solution to this would be powershell as it's built into Windows since win 7. Your problem seems to be relatively easy and straight forward. On Windows 7 open your start menu, type powershell and launch powershell ISE. Now you can start. What you want to do: Read csv Check each line if condition is met when condition is met, check which ...


1

A better option would be to use the logging features of whatever software you are using to stream. Trying to monitor the network traffic can be tricky and not always give you a clear picture of your actual activity. Most any service which is streaming video should have some sort of logs it can output, if for nothing more than debugging. Simply check the ...


0

The following should AFAIK work on any POSIX system. A random ordered list of files can be obtained with: for i in *; do echo "$i"; done | \ awk 'BEGIN { OFS="\t"; srand (); } { print rand (), $0 }' | \ sort | \ cut -f2- Explanation: for i in *; do echo "$i"; done ...


0

I feel like this question is a homework assignment. Let me do it for you. * in that script is likely returning an alphabetized listing of a directory. So you could intercept that listing and randomize at that point. You could also load the directory contents in to an array, randomly pick a number - mod the array size and if the result was empty, advance ...


0

Using the great and bright answer from htamas, I modified it a little to use it in an one liner, here it is: # create a temporary named pipe PIPE=(`(exec 0</dev/null 1</dev/null; (( read -d \ e < /proc/self/stat ; echo $e >&2 ; exec tail -f /dev/null 2> /dev/null ) | ( read -d \ e < /proc/self/stat ; echo $e >&2 ; exec tail -...


1

My general idea: Run the script from .bashrc in background: /foo/bar/script & or maybe a better alternative: nohup /foo/bar/script & The script should check if another instance of it has been started, it should silently exit if so. I don't know Ruby but it should be possible (in case it's not: build "wrapper" script in Bash that does the ...


2

Sounds like it needs to run when your system gets to runlevel 3. Try moving your script to /etc/rc3.d/S50scriptname


1

Move all images whose names appear in a txt file to a new folder using the windows command line I am trying use the text file as a list Then move all the JPEG files on that list from their Current folder to the Destination folder Below is an example batch script that will work for the need based on the logic examples you provided. @ECHO ON ...


0

You've only subscribed to the Changed event - this occurs when the content of a file is changed, or it is copied. This does not include files that are created or moved. May want to tinker to get the output how you want it, but the following should work: $source = "C:\Ops" $filter = "*.*" $fsw = New-Object System.IO.FileSystemWatcher $source, $filter -...


0

Divide in sub-problem In general when you cannot find a fast complete solution to your problem you can divide it in sub-problems more easy to be solved. A way is to create a tar file of the directory structure and a list of files to be touched inside the directory structure that you can compress after. You do not need to create the whole directory ...


1

WinGet, id, list Loop, %id% { this_ID := id%A_Index% If NOT IsWindow(WinExist("ahk_id" . this_ID)) continue WinClose, ahk_id %this_ID% break } return ; This checks if a window is, in fact a window. ; As opposed to the desktop or a menu, etc. IsWindow(hwnd){ WinGet, s, Style, ahk_id %hwnd% return s & 0xC00000 ? (s & ...


0

Are you required to use batch? If you're willing to use Powershell, which has been part of the Windows OS for many years now, this is not hard to to. To see only the unique items: get-content .\input.txt | select -unique | out-file unique.txt Are you also trying to say you want to know which words are duplicated? If so, this will give you some information ...


1

Next commented code snippet should do the job: @ECHO OFF SETLOCAL EnableExtensions DisableDelayedExpansion rem delete auxiliary variables for /F %%G in ('set ___ 2^>NUL') do set "%%G=" rem count up number of occurrences for /F tokens^=2^ delims^=^" %%G in (' FINDSTR /C:"Widget Name=" "configure.txt" ') do set /A "___%%G+=1" rem subtract 1 to ...


0

Just write a one line script that sends Alt-F4. But I'm assuming you want to shutdown downs? Why not use the Shutdown command - DOC: https://autohotkey.com/docs/commands/Shutdown.htm You can also use the regular shutdown command that http://stackoverflow.com/questions/162304/how-do-i-shutdown-restart-logoff-windows-via-a-bat-file


0

You can check if a custom variable has been set, otherwise set it and then add the new entries: if [ "$MYPATHS" != "true" ]; then export MYPATHS="true" export PATH="$PATH:$HOME/bin:" # java stuff export JAVA_HOME="$(/usr/libexec/java_home)" export M2_HOME="$HOME/Applications/apache-maven-3.3.9" export PATH="$JAVA_HOME/bin:$M2_HOME/...



Top 50 recent answers are included