![]() The only problem with my example is that in order to learn about 'select-string' I had to know to tell google that it needed to work like 'grep'. The data in the file mostly looks like this over and over again:Ġ015 1763 E07B type errpt.txt | select-string "^00" I have a cool command that can get what my initial error reporting command returns from unix into powershell on the fly, but for this comparison, my data always starts in a file called ‘errpt.txt’. In this case, I need to pull out MAC addresses from an error report, get rid of duplicates, and email the results to some one else, with one result per line. In this way I can get PowerShell ‘under my fingers’ so I can turn to it quickly. Because both have a strong base of using the pipe ( | ) to cascade text from one command to another, I simply pipe my unix problem into my powershell and solve it in Windows rather than AIX. Since most of the problems I have to solve with a shell are unix problems, it might seem that powershell couldn’t help me. By writing new scripts or functions or simply downloading new tools from the internet, the power of a shell is endless. Even if you could have a swiss-army knife graphical tool (this is probably excel), you still are limited to how its authors imagined that you could use it. While initial data extraction may be easier and faster, all of the pieces of your solution need to be reinvented and rewritten for a new application or tool and data must be extracted from one and placed into the next. This is a stark contrast to using graphical interfaces to solve problems. Working in a shell can be a liberating and elegantly simply REPL experience. ![]() This is very different from programming in a language like C# or even VB.Ī shell seeks to solve very different problems from traditional compiled languages and can even help you to figure out what you are trying to figure out if you don’t initially know. This has been my approach using the korn and bash unix shells and I think it is a great starting point for PS. ![]() You then can create tiny ‘throw-away’ scripts over and over again to solve whatever small problem you face during the day. You do most of your work from it, and slowly surround yourself with quick little functions and tools. In my opinion, you open up a shell at the beginning of the day and basically ‘live it in’. As I dig deeper into PowerShell from an Administrator perspective, I try to use it as much as possible in my daily work as a true shell. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |