Simon, Andrew, All:
Simon is correct. The correct switches will indeed allow you to write
the output of any command to a file. This works everywhere, because
everybody wants this kind of functionality--whether Mac, Windows, or
Linux/Unix.
It's called redirection, and it goes one of two ways:
Using the greater than symbol, namely '>' you send output somewhere.
Using my last example of the env command, here's a command that sounds
the output of env into a file:
env > my_environment.txt
The other direction reads input FROM somewhere.
The symbol for this is the less than symbol, i.e. '<' and takes
whatever is in the file as input into the command.
The uses of this second one are a bit harder for newbies to understand,
but trust me, you're going to love it.
Here's a quick and dirty example. Unfortunately, you first have to get
the gawk command installed, as the script below uses gaw.
If you have homebrew, the task is simple:
homebrew install gawk
Back to an example of indirection: Need to sum your monthly budget? Keep
your income and expenses in an ascii text file where the first word is a
number. Positive numbers are for income, and negative numbers for
expenses: eg.,
1000 weekly check from my boss for working too hard
-90 this months utility bill
Need comments in your file? No problem. Any first word not a number is
just ignored, and you can temporarily even take numbers out of the
calculation by commenting them, e.g.:
#70 cell phone service--just paid it
Now create the following as a script file, meaning take this content and
make it executable:
<cut here>
#!/bin/bash
gawk '{ sum += $1 }; END { print sum }'
<end script>
Bingo, you've got a script in a file, meaning you've got a new command.
I call mine 'sumit' as in sum it. So, if my income and expenses are in a
file called budget.txt, I can simply do:
sumit <budget.txt
And hear I've got 910 left.
Simon A Fogarty writes:
> Hi Andrew,
>
> Terminal should let you do what your after,
>
> With the listing of files and if you use the correct switchs you should be
> able to write the list of files and associated data to a file
> I know it's possible to do this in ms dos and power shell, so I would think
> linux etc would do the same thing.
>
> As for tab complete in the terminal,
>
> So long as you have the name correct to the point you hit the tab key then it
> should work for you.
> As long as there is a file or folder name with what your looking for.
>
> I use it when typing long commands like
> Sudo /Applications
> At the start of the creation of a bootable Usb flash drive.
>
> So as long as you have the name correct including any uppercase or symbols in
> the name then tab complete should be fine
>
>
>
> -----Original Message-----
> From: 'Andrew Lamanche' via MacVisionaries <[email protected]>
> Sent: Monday, 30 March 2020 3:22 AM
> To: 'E.T.' via MacVisionaries <[email protected]>
> Subject: A couple Terminal questions
>
> Hi,
>
> When working in Terminal and command line, is it possible to examine the
> window content with Voiceover? Say , ls -l command produces a list of files
> in the directory I am in. How can I examine each file and maybe even copy
> their names to clipboard or details about them if I were to use the -l flag,
> which would produce long information about each item.
>
> Secondly, reading a book on Command Line, one of the shortcut techniques the
> author teaches is to start typing the name of a directory to which one wishes
> to change and then pressing tab, which would result in Terminal completing
> the name or else giving a list of available names if there should be more
> than one. This doesn’t seem to work. When I press the tab, I hear the
> ominous bong bong. So this technique doesn’t work. Any thoughts on this?
>
> andrew
>
> --
> The following information is important for all members of the Mac Visionaries
> list.
>
> If you have any questions or concerns about the running of this list, or if
> you feel that a member's post is inappropriate, please contact the owners or
> moderators directly rather than posting on the list itself.
>
> Your Mac Visionaries list moderator is Mark Taylor. You can reach mark at:
> [email protected] and your owner is Cara Quinn - you can reach Cara at
> [email protected]
>
> The archives for this list can be searched at:
> http://www.mail-archive.com/[email protected]/
> ---
> You received this message because you are subscribed to the Google Groups
> "MacVisionaries" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/macvisionaries/BB072597-FDA8-4971-B666-361890504466%40me.com.
>
> --
> The following information is important for all members of the Mac Visionaries
> list.
>
> If you have any questions or concerns about the running of this list, or if
> you feel that a member's post is inappropriate, please contact the owners or
> moderators directly rather than posting on the list itself.
>
> Your Mac Visionaries list moderator is Mark Taylor. You can reach mark at:
> [email protected] and your owner is Cara Quinn - you can reach Cara at
> [email protected]
>
> The archives for this list can be searched at:
> http://www.mail-archive.com/[email protected]/
> ---
> You received this message because you are subscribed to the Google Groups
> "MacVisionaries" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/macvisionaries/SYCPR01MB404834FD7E074C845B7DD7D88ACB0%40SYCPR01MB4048.ausprd01.prod.outlook.com.
--
Janina Sajka
Linux Foundation Fellow
Executive Chair, Accessibility Workgroup: http://a11y.org
The World Wide Web Consortium (W3C), Web Accessibility Initiative (WAI)
Chair, Accessible Platform Architectures http://www.w3.org/wai/apa
--
The following information is important for all members of the Mac Visionaries
list.
If you have any questions or concerns about the running of this list, or if you
feel that a member's post is inappropriate, please contact the owners or
moderators directly rather than posting on the list itself.
Your Mac Visionaries list moderator is Mark Taylor. You can reach mark at:
[email protected] and your owner is Cara Quinn - you can reach Cara at
[email protected]
The archives for this list can be searched at:
http://www.mail-archive.com/[email protected]/
---
You received this message because you are subscribed to the Google Groups
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/macvisionaries/20200330084026.GO2206%40rednote.net.