Extract the correct format of file Name


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extract the correct format of file Name
# 1  
Old 11-13-2016
Extract the correct format of file Name

All,

Objective : Extract the correct format of a file name.

Please share the script command which will extract the correct format of the file after untarring.
Example : If the file is of .csv format then extract filename.csv
if the file is having .CSV then extract the same.CSV
if the file is .txt then extract .txt
if the file is .TXT then extract .TXT
if the file is .SEQ the extract .SEQ

the tar file can consist of format of the file. ie.txt or .TXT or .csv or .CSV or .SEQ.


Thanks
Mahesh
# 2  
Old 11-13-2016
Quote:
Originally Posted by Mahesh G
All,

Objective : Extract the correct format of a file name.

Please share the script command which will extract the correct format of the file after untarring.
Example : If the file is of .csv format then extract filename.csv
if the file is having .CSV then extract the same.CSV
if the file is .txt then extract .txt
if the file is .TXT then extract .TXT
if the file is .SEQ the extract .SEQ

the tar file can consist of format of the file. ie.txt or .TXT or .csv or .CSV or .SEQ.


Thanks
Mahesh
Please give a much clearer description of what you are trying to do giving sample input, sample output, and a description of what logic is to be used to transform the input(s) you have to the output(s) you want.

Untarring a file extracts all of the files in that archive unless you specify operands telling tar or pax to only process of subset of the archived files. So, after you have untarred a tar archive, why do you need to extract a file from itself???
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check user entered correct file format or not?

Hi Experts, path=/db/files/ format=$1 User can enter any file format.compare the user file format with actual file format existed in the directory /db/files. User enter all characters as "A" apart from date format. example1: user will be entering the file format AAA_AA_YYYYMMDD.AAA Actual... (6 Replies)
Discussion started by: nalu
6 Replies

2. Shell Programming and Scripting

Html output in correct format

Hi, I am running two scripts as below. In Script 1 i am getting correct output in proper HTML format while in script 2 i am not getting output in mail and only html code is getting printed.I want to get the output of script 2. Please guide. 1.IFILE=/home/home01/Report.csv if #Checks... (7 Replies)
Discussion started by: Vivekit82
7 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Downloaded file is not correct format

Hi, Recently we migrated an application in HP UX to Linux. The files(scripts & logs)download from HP UX coming in a formatted way in MS notepad. However the files in Linux are not in correct format in MS notepad(No spaces , some spl symbols like square).We tried both ASCII and binary but no... (2 Replies)
Discussion started by: nag_sathi
2 Replies

4. Shell Programming and Scripting

extract strings from file and display in csv format

Hello All, I have a file whose data looks something like this I want to extract just the id, name and city fields in a csv format and sort them by id. Output should look like this. 1,psi,zzz 2,beta,pqr 3,theta,xyz 4,alpha,abc 5,gamma,jkl (12 Replies)
Discussion started by: grajp002
12 Replies

5. UNIX for Advanced & Expert Users

How to extract a particular file in tar.Z format

Hi , I need to extarct only a particulay files from the tar.Z. ie i need to extract one.txt from test.tar.Z. The test.tar.Z may contain lot of file and folders. Please help me to extract particular file to some location. Regards, Kalai. (1 Reply)
Discussion started by: kalpeer
1 Replies

6. Shell Programming and Scripting

use of format file to extract columns from a source file

hi experts lets say my format file is B B ========= column no,name,type,length 1,ee,N,12 3,hj,N.4 4,kl,N,5 source file ======== d e f g h i 5 8 9 7 6 5 1 3 4 5 6 6 (2 Replies)
Discussion started by: subhendu81
2 Replies

7. Shell Programming and Scripting

AWK CSV to TXT format, TXT file not in a correct column format

HI guys, I have created a script to read 1 column in a csv file and then place it in text file. However, when i checked out the text file, it is not in a column format... Example: CSV file contains name,age aa,11 bb,22 cc,33 After using awk to get first column TXT file... (1 Reply)
Discussion started by: mdap
1 Replies

8. Shell Programming and Scripting

extract and format information from a file

Hi, Following is sample portion of the file; <JDBCConnectionPool DriverName="oracle.jdbc.OracleDriver" MaxCapacity="10" Name="MyApp_DevPool" PasswordEncrypted="{3DES}7tXFH69Xg1c=" Properties="user=MYAPP_ADMIN" ShrinkingEnabled="false" ... (12 Replies)
Discussion started by: sujoy101
12 Replies

9. Shell Programming and Scripting

extract specific data from xml format file.

Hi, I need to extract the start time value (bold, red font) under the '<LogEvent ID="Timer Start">' tag (black bold) from a file with the following pattern. There are other LogEventIDs listed in the file as well, making it harder for me to extract out the specific start time that I need. . .... (7 Replies)
Discussion started by: 60doses
7 Replies

10. UNIX for Advanced & Expert Users

Correct format in a log file

I'm trying to read the output of a .sql script (simple insert and commit oracle pl/slq script) to a log file using a shell script. My problem is I end up with a log file that looks like this: sd12@phenix97:/detain/sd12/logs > cat 20071205_detain_20071206.log 12320496 rows created. Commit... (11 Replies)
Discussion started by: sd12
11 Replies
Login or Register to Ask a Question