Printing last modified sub-directory's files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Printing last modified sub-directory's files
# 1  
Old 12-24-2015
Printing last modified sub-directory's files

hey,
I need to write a command line (only one line), which prints the content of the files of the last modified sub-folder
thanks in advance

I have to use grep for this
# 2  
Old 12-24-2015
Hello, sijaanh

Why does it has to be one line?
Why does it has to be grep?
Is this homework?
What have you tried?
# 3  
Old 12-24-2015
This is not a homework.. but a test question and I dont have the answer..
they gave me a hint to use grep expressions such as }[:alpha:] [:alnum:], , ,[:space:][:digit:], ,+,?,-{*,$,^, !

ls -t : this give me the last modified directories by order
I have to get into this folder and print it's files content!
I have no idea where to start from

---------- Post updated at 01:20 PM ---------- Previous update was at 01:19 PM ----------

ls -t | head -n1
this gives me the name of the last modified directory
# 4  
Old 12-24-2015
Moderator's Comments:
Mod Comment There is no difference between doing homework for a class and taking a test. We are not here to help you cheat on a test. If you want help on homework or test problems, file them in the homework and coursework forum and include a completely filled out homework template as indicated in the private message you received a little while ago.

And, please review the rules you agreed to when you joined the UNIX & Linux Forums

This thread is closed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

to pick the latest file modified in a directory

I wan to pick the latest modified file name and redirect it to a file .. ls -tr | tail -1 >file but this is printing file ins side the filename , can anyone help me out (5 Replies)
Discussion started by: vishwakar
5 Replies

2. Shell Programming and Scripting

last modified directory

hi everyone suppose i have many directory under one directory. now i want to find out the last modified directory so i executed the command ls -ltr but it gives me the directory structure too and i don't want this so i removed 'r' also but it too gives me directory... (2 Replies)
Discussion started by: aishsimplesweet
2 Replies

3. Shell Programming and Scripting

Copy last modified directory from path using Perl

Hi I need to copy last modified directory from path /users/bin to be copied to /tmp in a perl script ...somehow my script is not allowing me to do cd /users/bin. i have tried $dir = `find /users/bin -maxdepth 1 -type d -mtime 0 ` cp -R $dir /tmp/new but it says missing destination... (1 Reply)
Discussion started by: shaveta
1 Replies

4. Shell Programming and Scripting

Copy Last modified directory to another directory

Hi, I have to copy last modified Directory to another directory.How can i Do using pipe or redirect cp -R 'ls -lrt|tail -1' test is not working. please help. (3 Replies)
Discussion started by: shaveta
3 Replies

5. UNIX for Dummies Questions & Answers

Number of files in a directory modified on a date

Hi How to list all the files in a directory that are modified on a particular date? Also need to know the count,i.e number of files modified on a particular date. Thanks Ashok (1 Reply)
Discussion started by: ashok.k
1 Replies

6. UNIX for Advanced & Expert Users

how to open a last modified file in a directory

how to directly open a last modified file in a directory? Please help (5 Replies)
Discussion started by: apsprabhu
5 Replies

7. Shell Programming and Scripting

Find the directory modified/created before 4 days

Hi, I have an application which creates some directories while running. I want to delete these directories which are 4 days older. i tried find . type d -mtime +1 -print And it is working fine.. but find . type d -mtime +4 -print is not giving any results which are 4 days... (6 Replies)
Discussion started by: Tuxidow
6 Replies

8. Shell Programming and Scripting

Printing files from a directory

Hi, I need help in printing files from a directory. eg: a directory called /home/ABC and there are 3 files in it. I need to give printout one bye one. One more thing is I need to print date and the path on the top of each page...like... Sep 30 14:22 2008 /home/ABC Page 1 I've been... (1 Reply)
Discussion started by: injeti
1 Replies

9. Shell Programming and Scripting

How to zip a modified file 15 days before but not scanning my sub directory files

I am using zip -m option to zip my files, but i dont want my sub directories files to be zipped (1 Reply)
Discussion started by: skrish70
1 Replies

10. UNIX for Dummies Questions & Answers

printing number of files ONLY in ~ directory

Could someone help me please. I'm trying to write a shell script that prints the number of files I have in my home directory. Files only though, directories not included. I was thinking about using a pipe that includes wc but I don't know any commands that isolate the number of files you have in... (4 Replies)
Discussion started by: fasdafdsf
4 Replies
Login or Register to Ask a Question