Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Create a file with a path?
Name: 427v8 Date: April 7, 2003 at 07:44:19 Pacific OS: AIX CPU/Ram: 686 256
Comment:
In a ksh script I get a file with a path from another program. I need to create the file and it's directories.
I know mkdir -p can make the dirs but how to get the dirs without the filename?
Name: 427v8 Date: April 7, 2003 at 11:22:31 Pacific
Reply:
Thanks nails! dirname, just what I was looking for.
mibwalker, how do you handle variable length paths?
Like /dir1/file.txt vs /dir1/dir2/.../dir99/file.txt
0
Response Number 4
Name: mibwalker Date: April 7, 2003 at 13:31:59 Pacific
Reply:
The cut command does that with the -f (field). The -d is delimiter. I cut that text string into feilds using / as the delimiter. If you had a path like /dir1/dir2/dir3/file.txt cut -f2 -d"/" would give you dir1 cut -f1-2 -d"/" would give you /dir1/ This one is a little tricky because of the / at the very beginning the 1-2 means feild 1 through 2 the first slahs counts as a feild seperator. Just play around with it a little, I use cut for all kinds of things.
Summary: I am trying to create a script that counts the number of files that contain a certain string. But doesn't list the files...just the number of files that actually contain it. I have what I had written ...
Summary: T.T. I'm assuming you want to copy files with a creation date of May 13. The 6th and 7th fields of the 'ls -l' command are the month and day: #!/bin/ksh ls -l |while read f1 f2 f3 f4 f5 f6 f7 f8 f9 d...
Summary: The echo command is echoing just an empty line, and each line in unix/linux terminates with one character referred to as a newline character. On other platforms it may be referred to as the linefeed ...