Sponsored Content
Top Forums Shell Programming and Scripting Reading files of different type and same basename Post 302785003 by Akshay Hegde on Sunday 24th of March 2013 06:32:34 AM
Old 03-24-2013
Sir
Code:
ufctn

function not working with my OS(Ubuntu 12.04 LTS) but I could is info page

following is error msg
Code:
ufct1: command not found
ufct1: command not found
ufct2: command not found
ufct1: command not found
ufct1: command not found
ufct2: command not found
ufct2: command not found
ufct2: command not found

any alternate solution is possible ?
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Type v for generated files

Hi All, I was checking some of the files and I got the following entries:- =============== v, 664, serv, serv, version.txt, exe L, 775, serv, serv, start.sh, eventserv ================ Could someone please tell me what does the type"v" and "L" represent to. I have not... (2 Replies)
Discussion started by: shubhranshu
2 Replies

2. Shell Programming and Scripting

[php] ftp get all files from a certain file type

Hi all, I googled for this kind of function but didn't find anything. I have an FTP connection with a server, went to the dir. In this dir there are several TXT files. I would like to have function that downloads all this files, based on their .txt extension. In bash, for example, simply:... (10 Replies)
Discussion started by: laurens
10 Replies

3. UNIX for Advanced & Expert Users

Deleting older files of a particular type

hi This should be easy but i'm obviously missing something obvious. :) I'm looking to delete files from yesterday and older of extension .txt and there a range of subfolders with these files in them. The command runs but doesn't delete anything. SUSE 10. find /testfolder -maxdepth 2 -type f... (6 Replies)
Discussion started by: cmap
6 Replies

4. UNIX for Advanced & Expert Users

find -type d returning files as well as directories

Can anyone see why the following command returns all files and not just the directories as specified? find . -type d -exec ls -F {} \; Also tried find . -type d -name "*" -exec ls -F {} \; find . -type d -name "*" -exec ls -F '{}' \; -print Always returns all files :-\ OS is... (2 Replies)
Discussion started by: tuns99
2 Replies

5. Shell Programming and Scripting

Delete files of the same type if there are more than 3

hi, I would like to delete files in a folder starting with letters ab and fe and so on. It should only delete if there are more than 3 files of that type in that folder. Please suggest me how to write a script. i am new to this scripting. (4 Replies)
Discussion started by: Sneddy
4 Replies

6. UNIX for Dummies Questions & Answers

Search in one type of files and replace

I am not sure how to search and replace the word in the few specific files. I need to search and replace word in only the name containing pepsi in the filename. (12 Replies)
Discussion started by: ramkumar15
12 Replies

7. Shell Programming and Scripting

Errors trying to use all files of a type

I am trying to create a code that will use all the bam files stored on a separate drive (/media/cmccabe/C2F8EFBFF8EFAFB9/pool_I_090215), run them in a program that I have changed the directory to, and the output gets re-directed to (/home/cmccabe/Desktop/NGS/pool_I_090215). I have tried the... (11 Replies)
Discussion started by: cmccabe
11 Replies

8. Shell Programming and Scripting

Latest list of files of each type

find /tmp/testlog/kSR*"_"2018* -type f -printf '%T@ %p\n' | sort -n | tail -3 | cut -f2- -d" " /tmp/testlog/log/KSR04_2018-07-05.log /tmp/testlog/log/KSR04_2018-07-06.log /tmp/testlog/log/KSR01_2018-07-06.log But, I would see the following output(latest files for each KSR tuype) ... (3 Replies)
Discussion started by: jhonnyrip
3 Replies
basename(1)						      General Commands Manual						       basename(1)

NAME
basename, dirname - Returns the base file name or directory portion of a path name SYNOPSIS
basename string [suffix] dirname string STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: basename: XCU5.0 dirname: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
None OPERANDS
A string to be evaluated. This string may be empty. A file name suffix to be deleted if found. This operand applies to the basename com- mand only, and is optional. DESCRIPTION
The basename command reads the string specified on the command line, deletes the portion from the beginning to the last / (slash), and writes the base file name to standard output. If suffix is specified on the command line and suffix appears in string, the string is returned with the suffix removed. The dirname command reads the string specified on the command line, deletes from the last / (slash) to the end of the line, and writes the remaining path name to standard output. [Tru64 UNIX] The basename and dirname commands are generally used inside command substitutions within a shell procedure to specify an out- put file name that is some variation of a specified input file name. For more information, see the csh(1), ksh(1), and sh(1b) or sh(1p) reference pages. The following table demonstrates the processing applied to characters with particular meanings by the basename and dirname commands. ------------------------------ basename dirname string Result Result ------------------------------ / / / // / / /a/b b /a //a//b// b //a <null> err msg err msg a a . "" . /a a / /a/b b /a a/b b a ------------------------------ NOTES
It is not an error if suffix is not a part of string. EXAMPLES
To display the base file name of a shell variable, enter: basename $WORKFILE This displays the base file name of the value assigned to the WORKFILE shell variable. If WORKFILE is set to /u/gabe/program.c, then program.c is displayed. To construct, in a shell script, a file name that is the same as another file name, except for its suffix, enter the following command, using grave accents: OFILE=`basename $1 .c`.o This assigns to OFILE the value of the first positional parameter ($1), but with its suffix changed to $1 is /u/jim/program.c, then OFILE becomes program.o. Because program.o is only a base file name, it identifies a file in the current directory. The grave accents perform command substitution. To construct the name of a file located in the same directory as another, enter the following command, using grave accents: AOUTFILE=`dirname $TEXTFILE`/a.out This sets the AOUTFILE shell variable to the name of an a.out file that is in the same directory as TEXTFILE. If TEXTFILE is /u/fran/prog.c, then the value of dirname $TEXTFILE is /u/fran and AOUTFILE becomes /u/fran/a.out. ENVIRONMENT VARIABLES
The following environment variables affect the execution of basename and dirname: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the inter- nationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non- empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: csh(1), ksh(1), Bourne shell sh(1b), POSIX shell sh(1p) Standards: standards(5) basename(1)
All times are GMT -4. The time now is 03:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy