Category: UNIX-Unix Beginner
finding funny charaters in a string
hi,
i have got a little problem where some of the files i created had some funny characters e.g space ,"^m" etc inserted in the full file name and which caused our backup script to skip those files.
is it possible to find out if there are any funny charaters in a string ?
Read More...
Category: UNIX-Unix Beginner
how to change current working directory for dbx on unix?
how to change current working directory for dbx on unix?
means i'll run pgm from one directory , but getcwd() should return path which i want to be, which is not d current dir
Read More...
Category: UNIX-Unix Beginner
help needed in basic unix
hi friends,
how to obtain list of groups we r a member of and redirect it to a file.
how to append the details of current os to a file.
how to append the estimated file space to a file.
how to append the details of users loged on along wth their current activity into a file.
thank you...i'm alien to unix os.
Read More...
Category: UNIX-Unix Beginner
how to obtain list of users ?
how to obtain list of users found in /home/ and append it to a file.
Read More...
Category: UNIX-Unix Beginner
how do i pass a wild card as a variable
hi,
i would like to pass a wild card as part of an argument. but when i do it the script views the wild card as text.
example:
sfile=mg1a*
sort $sfile > $sfile.sorted
what i get is mg1a*.sorted
the problem is i am passed a series of files where the first few characters like "mg1a" are constant. the additional part of the file name is a date time stamp. i will never know the exact date time stamp. i need to do a search for mg1a* which will find me one file. how can i write my script so the variable $sfile will know that the "*" in mg1a* is a wild card not text?
i know i can write code to run "ls" on a directory and get all file names then write a loop or do statement to do my sort based upon that list regardless of the file name. but i have more files in the dir than i want to grab. i also know i can run the "ls" command output the file names in the dir to a file and grep for the part fo the file names i am looking for. i also think this can be done if i pput the whole comamnd ibut current design restricts me form going that path. it would require a whole re-write and i am trying to avoid that.
thank you.
Read More...
Category: UNIX-Unix Beginner
delete compressed files from year 2005
i'm trying to delete files that were created/modified in the year 2005 that we compressed and have the .z extension on them. i tried using the awk utility but the syntax is incorrect. i don't know how to use a wildcard to capture all the compressed files. here's the code i used
( ls -lr | awk '$8 == "2005" && $9 == ".z" {print $0}' )
any suggestions on how to do this would be greatly appreciated.
Read More...
Category: UNIX-Unix Beginner
find, make and move file based on username
hi there,
i'm new to unix( just 3month used),
i found my new box contained alot of files and directories in /home/box/
i've tried to search script in tis forum and found many of them but, i don't know
how to combine them to make a script, although using pipes.
my tasks are:
1) to scan user dir in /home/user/ - i'm used ls-ld /home/$user/ , $user must be key in.
2) then, grouping all files in scanned dir(in task 1), into group of extensions such as ".txt",".sh",".dat"
i used the ls -l | awk 'begin {fs="."} {print $2}'>index.txt
3) based on index.txt, i'm going to make directories referring to those extensions eg.
/home/user/txtextension
/home/user/datextension/
then move all of files to their extension dir. i'm sorry, i can't find the way to create this script.
i tried all my best to combine all above simple script but, no.3 is quite hard for me.
is there any unix-shell expert have ideas, solutions, or even example scripts to guide me
regards,
Read More...
Category: UNIX-Unix Beginner
deleting core file??
hi,
i am using unix through exceed on my pc to gain access to some cfd programs. one of these programs crashed a couple of days ago and created a file called core, which i understand is a back up file and can be deleted immediately. however, before deleting it i rearranged some of my other files in my area, then tried to delete core. however, it would not delete and then all my other programs would not open correctly or load files. any advice?
thanks
Read More...
Category: UNIX-Unix Beginner
pad zeros
hi can i know command to pad zeros to a value
code:
Read More...