Unix questions - Some Unix Questions

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > April 2004 > Some Unix Questions





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Some Unix Questions
David McGeorge

2004-03-28, 10:35 pm

How can I list contents of a directory and all of its subdirectories,
providing full details, but only regular files that haven't been
accessed in the last 2 days?

How can I delete all files older than 1 year from a directory?

What utility would you use to swap columns 1 and 2 in a text file?

How can I replace a string "2001" for "2002" in a text file?

Howe can I cut off the first column in a text file?

Thanks a lot.



__________________
Alan Connor

2004-03-28, 11:38 pm

On 28 Mar 2004 19:30:03 -0800, David McGeorge <soalvajavab1@yahoo.com> wrote:
>
>
> How can I list contents of a directory and all of its subdirectories,
> providing full details, but only regular files that haven't been
> accessed in the last 2 days?
>
> How can I delete all files older than 1 year from a directory?
>
> What utility would you use to swap columns 1 and 2 in a text file?
>
> How can I replace a string "2001" for "2002" in a text file?
>
> Howe can I cut off the first column in a text file?
>
> Thanks a lot.
>
>
>
> __________________


Well, you actually DO the reading you were assigned in class, and then
you'll know.

Or be close, anyway.

Then you give it a shot and post your efforts here for commentary.

Not going to learn how to use Nix if you aren't very comfortable with
a lot of reading, and forever....

AC

Ed Morton

2004-03-29, 11:36 am



David McGeorge wrote:

> How can I list contents of a directory and all of its subdirectories,
> providing full details, but only regular files that haven't been
> accessed in the last 2 days?


man ls
man find
man stat

> How can I delete all files older than 1 year from a directory?


man rm
man find
man stat

> What utility would you use to swap columns 1 and 2 in a text file?


man sed
man awk
man cut

> How can I replace a string "2001" for "2002" in a text file?


man sed
man awk
man read
man echo
man print
man printf

> Howe can I cut off the first column in a text file?


man sed
man awk
man read
man echo
man print
man printf

> Thanks a lot.


You're welcome. Feel free to coma back with any questions when you've
attempted the solutions.

Regards,

Ed.

Kade Hodges

2004-04-15, 4:38 am

soalvajavab1@yahoo.com (David McGeorge) wrote in message news:<bc907f76.0403281930.209c93bc@posting.google.com>...
> How can I list contents of a directory and all of its subdirectories,
> providing full details, but only regular files that haven't been
> accessed in the last 2 days?
>
> How can I delete all files older than 1 year from a directory?
>
> What utility would you use to swap columns 1 and 2 in a text file?
>
> How can I replace a string "2001" for "2002" in a text file?
>
> Howe can I cut off the first column in a text file?
>
> Thanks a lot.
>
>
>
> __________________


You are using Linux?
Mike

2004-04-15, 8:35 am

In article <3e1398a2.0404150040.7aa05a54@posting.google.com>, Kade Hodges wrote:
> soalvajavab1@yahoo.com (David McGeorge) wrote in message news:<bc907f76.0403281930.209c93bc@posting.google.com>...

find . -type f -mtime -2 -ls
[vbcol=seagreen]

find . -mtime +365 -print | xargs rm -f
[vbcol=seagreen]

awk '{ tmp=$1 ; $1 = $2 ; $2 = tmp ; print }'
[vbcol=seagreen]

sed 's/2001/2002/g' < file > file.new
[vbcol=seagreen]

man cut
perl -e 'while(<> ) { @a = split(" "); shift(@a); print join(" ", @a), "\n";'
[vbcol=seagreen]
>
> You are using Linux?

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com