redirect - Unix piping and redirection -


Assume that you want to read the file as a password, password password.txt, replace each uppercase letter A lowercase letter and a "$$" for each "## Overwrite it). How do you do it with tr command? Indication: Use piping and file redirection.

I tried these 2 commands, but they I did not believe that the file has been stripped by the system, so passwords.txt is empty.

cat passwords.txt | Tr '[A-Z`!'] ' '[A-Z' # ']'

tr รข ???? [A-Z "!"] A ???? one ???? [az "#"] a ?? ?? & lt; passwords.txt & gt; Passwords.txt

I know that we write it in a temporary file and "& amp; Amp; Amp; To change the temporary file name of passwords.txt, however, it is a homework problem and we have "& amp; amp; amp; amp; so far, so I believe that to do this, the other way to do this with piping and redirect only

I think the file has been stripped by the system, so that passwords. After the txt becomes empty.

You are right You tr redirect to the temporary file output

In addition, use the quotes around ! (I think its purpose is $ ) and # is very important you can say:

  cat / etc / passwd | tr 'az $' 'az #' & gt; Terminate the useless use of  cat  by using temporary & amp; amp; md temporary / etc / passwd   

or indirection:

  tr 'AZ $' 'Edge #' & lt; / etc / passwd & gt; Temporary & amp; Amp; MV Temporary / etc / passwd   

Here is a & amp; Amp; & Amp; Amp; There is a control operator separating the two commands if you say:

  Command1 & amp; Command2   

Then Command2 is executed, and only if, Command1 returns the position of zero, i.e. if command1 succeeds.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -