Find the answer to your Linux question:
Results 1 to 3 of 3
I know this isnt a mandriva "thing"but im on mandriva and am not sure where else to post this. It might seem simple to you but i come from a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2007
    Posts
    2

    Piping + redirection


    I know this isnt a mandriva "thing"but im on mandriva and am not sure where else to post this. It might seem simple to you but i come from a windows backround, so its abit new to me.

    anyways, here is the question. its for a linux essentials course that I am busy with to get LPI.

    The password file path : /etc/passwd
    Order this file to display the user name in reverse alphabetical order(z-a) and then use another command to put line numbers in front of each line. These changes are then put into a new file called passwrdformatted.txt

    now Im not sure about the first part. the reverse alphabetical order , do i use sort -r, and if so how ? ...

    Please gimme the full command.
    the command must be ONE line long.

    thanks.

  2. #2
    Linux User cyberinstru's Avatar
    Join Date
    Jan 2007
    Location
    India
    Posts
    362
    Try this...

    [QUOTE][cat /etc/passwd | sort -r | cat -n > sample.txt/QUOTE]
    ---------------------------------
    Registered Linux User #440311
    HI2ARUN _AT_ GMAIL _DOT_ COM
    ---------------------------------

  3. #3
    Just Joined!
    Join Date
    Mar 2007
    Posts
    2
    i had something similar to that, however it doesnt solve the problem of displaying the username in reverse alphabetical order . you have to grep "username" /etc/passwd is what i assume to be the missing part in the command, but how does it all go together

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •