10

Prepend each line of a file with a capital A and write a new file- awk '{print "A"$0}' < FILE > NEWFILE


9

To prepend X to the start of every line of file, writing to newfile, in Terminal: sed 's/^/X/' file > newfile Here I'm using sed, the Unix stream editor, to use a very simple regular expression to substitute the beginning of every line (the ^ symbol) with an X.


3

After doing a bit of research, it turns out that the -i option for ffmpeg takes a single filename and when converting a number of image files to a .mov file, it has to be in the form of e.g. %05d.png. Obviously the padding of the sequential numbering can be a different number of digits and the image type extension can vary as well. Then to that end, the ...


2

If you're running it as an Automator quick action, then you can close all windows except the frontmost window of the frontmost application by using the code below inside a Run AppleScript action (you can delete any sample code that appears, including on run {input, parameters}...end run: tell application id "com.apple.SystemEvents" to tell the first process ...


2

The stream editor sed is likely the fastest and sharpest tool built for exactly this task. Use the insert command (the newline after \ is part of the syntax): sed 'i\ X' file > newfile $ time sed 'i\ X' line250000 >/dev/null real 0m0.118s user 0m0.102s sys 0m0.012s The delay or overhead for this operation is ...


1

wget can read URLs directly from a file (-i file), and knows how to pause between downloads (-w seconds), so you don’t actually need a loop at all. Also, wget downloads into the current directory by default so you don't really need --directory-prefix either. Just run mkdir -p ~/Desktop/download cd ~/Desktop/download wget -E -H -k -p -w $((5*60)) -i file....


1

As I do not have access to the web app you are using, I really cannot test if this will work for you. The example AppleScript code, shown further below, with limited testing works for me as coded under macOS High Sierra. Overview: Gets the selected text in Google Chrome and places it on the clipboard in the chosen color as HTML data, and pastes it back ...


1

Yes, it is simple and there is no need, in this case, to involve System Events. Just ask Notes directly if the window exists, e.g.: tell application "Notes" exists window "Notes" end tell This returns either true or false, however the code in this form may not be as useful as either wrapping the query in an if statement block or assigning the results ...


1

You can do this with the System Events application - for example: tell application "System Events" if exists (window "Terminal — -zsh" of process "Terminal") then display dialog "Found" else display dialog "Not found" end if end tell Note that process is case sensitive while window is not. Therefore this will work if exists (...


1

Please try this. It might run faster. (edited my original answer with new code). tell application "Finder" set theWindows to {} set theCount to (count of windows) if theCount is greater than 1 then repeat with i from 2 to theCount set theWindow to window i copy theWindow to end of theWindows end repeat ...


1

I just found the answer! You just need to drag the variable from the bottom of the screen into the desired text box.


1

Your run handler looks lifted from Automator, but your desire to have it as a script invoked from the shell suggests it's designed to be run independently of Automator. Here's an edited form of the script that you can copy and paste into a terminal (like iTerm): (:(){ paste - << SCRIPT > "$*" && chmod +x "$*" #!/usr/bin/env osascript on ...


1

Right after tell application "iTerm" add: if (window count) is equal to 0 then reopen This will open a new window if none are open but iTerm is running. You can also use the following example AppleScript code to make sure window 1 exists before continuing, if one wasn't already open. if (window count) is equal to 0 then reopen repeat until exists ...


1

This bash snippet will prepend each line of a file with a hash (#) and save it to a new file: IFS=$'\r\n'; printf '#%s\n' $(</path/to/file.txt) > /path/to/newfile.txt Explanation IFS=$'\r\n': This sets the field separator so that only the characters \r (carriage return) and \n (newline) are used to delimit a string. The default setting can be ...


1

To make an ApplesScript droplet app, save the following example AppleScript code in Script Editor as an application: on open droppedItems repeat with droppedItem in droppedItems do shell script "/usr/local/bin/exiftool -all= " & ¬ quoted form of POSIX path of droppedItem end repeat end open Now drag and drop the target file(...


Only top voted, non community-wiki answers of a minimum length are eligible