Urgent help on Linux | |
Anonymous Coward User ID: 1339701 United States 03/10/2013 08:50 PM Report Abusive Post Report Copyright Violation | ... Quoting: Anonymous Coward 1339701 You're redirecting the file to the tr command. You want to do the complete head command first and then pipe the output to tr. you mean something like this head -2 stenton/gen_ed/cars2 | tr "[a-z]" "[A-Z]" Yes, butt as AC35769388 pointed out, you only want the 2nd line instead of the first two. ahhh head -2 stenton/gen_ed/cars2 | tail -1 | tr "[a-z]" "[A-Z]" yep |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 08:51 PM Report Abusive Post Report Copyright Violation | /home/msabbar/sample_dir2 `-- sample_dir |-- admin |-- cambridge | |-- cafeteria | |-- library | `-- security | |-- annex | |-- building | `-- parking |-- faculty |-- history.exe |-- markham | |-- annex | |-- building1 | `-- parking `-- stenton |-- gen_ed | |-- Holidays | `-- cars2 |-- lib_arts | |-- english.txt | `-- match.doc `-- phone_directory 11 directories, 12 files Your current directory is sample_dir. Display cars2 sorted numerically by the 4th field: Imagine if there was no country Stop the Sabre Rattlings and Wars |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 08:53 PM Report Abusive Post Report Copyright Violation | okay so this question: Quoting: IMAX Your current directory is sample_dir. Display cars2 sorted numerically by the 4th field: what command would be more appropriate ? i did ls -l stenton/gen_ed/cars2 | sort -nk 4 cat stenton/gen_ed/cars2 | sort -nk 4 ls stenton/gen_ed/cars2 | sort -nk 4 please post a couple of lines of the cars2 file so people can see what is in it. i can't show files within cars2...all i can show is the tree Imagine if there was no country Stop the Sabre Rattlings and Wars |
Anonymous Coward User ID: 35769388 Australia 03/10/2013 08:54 PM Report Abusive Post Report Copyright Violation | okay so this question: Quoting: IMAX Your current directory is sample_dir. Display cars2 sorted numerically by the 4th field: what command would be more appropriate ? i did ls -l stenton/gen_ed/cars2 | sort -nk 4 cat stenton/gen_ed/cars2 | sort -nk 4 ls stenton/gen_ed/cars2 | sort -nk 4 please post a couple of lines of the cars2 file so people can see what is in it. i can't show files within cars2...all i can show is the tree isn't cars2 a file? use less on it and see what is in there. |
Anonymous Coward User ID: 1339701 United States 03/10/2013 08:54 PM Report Abusive Post Report Copyright Violation | okay so this question: Quoting: IMAX Your current directory is sample_dir. Display cars2 sorted numerically by the 4th field: what command would be more appropriate ? i did ls -l stenton/gen_ed/cars2 | sort -nk 4 cat stenton/gen_ed/cars2 | sort -nk 4 ls stenton/gen_ed/cars2 | sort -nk 4 cat stenton/gen_ed/cars2 | sort -nk 4 is most appropriate. You don;t need to cat the file first. You can just sort it... sort -nk 4 stenton/gen_ed/cars2 |
Anonymous Coward User ID: 1339701 United States 03/10/2013 08:56 PM Report Abusive Post Report Copyright Violation | |
Anonymous Coward User ID: 35769388 Australia 03/10/2013 08:57 PM Report Abusive Post Report Copyright Violation | |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 09:03 PM Report Abusive Post Report Copyright Violation | okay so this question: Quoting: IMAX Your current directory is sample_dir. Display cars2 sorted numerically by the 4th field: what command would be more appropriate ? i did ls -l stenton/gen_ed/cars2 | sort -nk 4 cat stenton/gen_ed/cars2 | sort -nk 4 ls stenton/gen_ed/cars2 | sort -nk 4 cat stenton/gen_ed/cars2 | sort -nk 4 is most appropriate. You don;t need to cat the file first. You can just sort it... sort -nk 4 stenton/gen_ed/cars2 you're right but I don't get why cat or less or ls wouldn't work if it is asking me to display it? Imagine if there was no country Stop the Sabre Rattlings and Wars |
Anonymous Coward User ID: 1339701 United States 03/10/2013 09:08 PM Report Abusive Post Report Copyright Violation | okay so this question: Quoting: IMAX Your current directory is sample_dir. Display cars2 sorted numerically by the 4th field: what command would be more appropriate ? i did ls -l stenton/gen_ed/cars2 | sort -nk 4 cat stenton/gen_ed/cars2 | sort -nk 4 ls stenton/gen_ed/cars2 | sort -nk 4 cat stenton/gen_ed/cars2 | sort -nk 4 is most appropriate. You don;t need to cat the file first. You can just sort it... sort -nk 4 stenton/gen_ed/cars2 you're right but I don't get why cat or less or ls wouldn't work if it is asking me to display it? ls lists the files. cat displays the contents of a file. more or less show the contents of a file with page breaks and some tput formatting. Most commands that operate on the contents of a file do the cat for you. In the old days, you would have to cat a file and pipe the output to another command. |
Anonymous Coward User ID: 35769388 Australia 03/10/2013 09:08 PM Report Abusive Post Report Copyright Violation | you're right Quoting: IMAX but I don't get why cat or less or ls wouldn't work if it is asking me to display it? what wacky software are you using for this? how do you know when you get the "right answer"? does it go DING!!? maybe they replaced your shell with some weird shell, and it's not really a shell at all. it just wants you to put in the "correct command" and then it goes DING!!? |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 09:20 PM Report Abusive Post Report Copyright Violation | |
Anonymous Coward User ID: 1339701 United States 03/10/2013 09:21 PM Report Abusive Post Report Copyright Violation | |
Anonymous Coward User ID: 1339701 United States 03/10/2013 09:21 PM Report Abusive Post Report Copyright Violation | |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 09:21 PM Report Abusive Post Report Copyright Violation | you're right Quoting: IMAX but I don't get why cat or less or ls wouldn't work if it is asking me to display it? what wacky software are you using for this? how do you know when you get the "right answer"? does it go DING!!? maybe they replaced your shell with some weird shell, and it's not really a shell at all. it just wants you to put in the "correct command" and then it goes DING!!? yes exactly Imagine if there was no country Stop the Sabre Rattlings and Wars |
Anonymous Coward User ID: 35769388 Australia 03/10/2013 09:21 PM Report Abusive Post Report Copyright Violation | |
Anonymous Coward User ID: 35769388 Australia 03/10/2013 09:22 PM Report Abusive Post Report Copyright Violation | you're right Quoting: IMAX but I don't get why cat or less or ls wouldn't work if it is asking me to display it? what wacky software are you using for this? how do you know when you get the "right answer"? does it go DING!!? maybe they replaced your shell with some weird shell, and it's not really a shell at all. it just wants you to put in the "correct command" and then it goes DING!!? yes exactly then that is probably why you can't cat or ls or less the file, because they think you don't need to do that. |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 09:26 PM Report Abusive Post Report Copyright Violation | for this question Quoting: IMAX 11 directories, 12 files Your current directory is sample_dir. Display only the 1st field (last name) of each record in phone_directory: do i want to use the 'cut' command? cut, awk or sed. so i do cut -f1 stenton/phone_directory and cut -f stenton/phone_directory cut -uf 1 stenton/phone_directory cut -uf1 stenton/phone_directory nothing Imagine if there was no country Stop the Sabre Rattlings and Wars |
Anonymous Coward User ID: 1339701 United States 03/10/2013 09:28 PM Report Abusive Post Report Copyright Violation | Here's a good reason to learn Linux. Your own drone with a Linux development kit. [link to www.ardrone-flyers.com] |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 09:29 PM Report Abusive Post Report Copyright Violation | |
Anonymous Coward User ID: 35769388 Australia 03/10/2013 09:30 PM Report Abusive Post Report Copyright Violation | nothing? come on, doesn't it give you an error message? look at the phone_directory file with cat, less, more, vi, emacs, nano, or pico, and find out what the fields look like, and what the field separators are. read the cut man page and figure it out |
Anonymous Coward User ID: 1339701 United States 03/10/2013 09:31 PM Report Abusive Post Report Copyright Violation | for this question Quoting: IMAX 11 directories, 12 files Your current directory is sample_dir. Display only the 1st field (last name) of each record in phone_directory: do i want to use the 'cut' command? cut, awk or sed. so i do cut -f1 stenton/phone_directory and cut -f stenton/phone_directory cut -uf 1 stenton/phone_directory cut -uf1 stenton/phone_directory nothing Your current directory is sample_dir .. |
Anonymous Coward User ID: 1339701 United States 03/10/2013 09:35 PM Report Abusive Post Report Copyright Violation | |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 09:35 PM Report Abusive Post Report Copyright Violation | for this question Quoting: IMAX 11 directories, 12 files Your current directory is sample_dir. Display only the 1st field (last name) of each record in phone_directory: do i want to use the 'cut' command? cut, awk or sed. so i do cut -f1 stenton/phone_directory and cut -f stenton/phone_directory cut -uf 1 stenton/phone_directory cut -uf1 stenton/phone_directory nothing Your current directory is sample_dir .. yeah i know that...and sample_dir/stenton/phone_directory since i am currently in it, i type in stenton/phone_directroy Imagine if there was no country Stop the Sabre Rattlings and Wars |
Anonymous Coward User ID: 35769388 Australia 03/10/2013 09:37 PM Report Abusive Post Report Copyright Violation | |
Anonymous Coward User ID: 1339701 United States 03/10/2013 09:39 PM Report Abusive Post Report Copyright Violation | |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 09:46 PM Report Abusive Post Report Copyright Violation | |
Anonymous Coward User ID: 35769388 Australia 03/10/2013 09:50 PM Report Abusive Post Report Copyright Violation | |
Anonymous Coward User ID: 1339701 United States 03/10/2013 09:52 PM Report Abusive Post Report Copyright Violation | |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 10:10 PM Report Abusive Post Report Copyright Violation | |
IMAX
(OP) User ID: 35675988 Canada 03/10/2013 11:13 PM Report Abusive Post Report Copyright Violation | guys now icant answer this /home/msabbar/sample_dir2 `-- sample_dir |-- admin |-- cambridge | |-- cafeteria | |-- library | `-- security | |-- annex | |-- building | `-- parking |-- cars3 |-- faculty |-- history.exe |-- markham | |-- annex | |-- building1 | `-- parking `-- stenton |-- gen_ed | |-- Holidays | `-- cars2 |-- lib_arts | |-- english.txt | `-- match.doc `-- phone_directory 11 directories, 13 files Your current directory is sample_dir. Create a compressed archive of the stenton directory and it's contents, called stenton.tar.gz, and place it in the sample_dir directory. Use a non-verbose tar command with a single option string, including the option to invoke gzip: Imagine if there was no country Stop the Sabre Rattlings and Wars |