Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Tar command generation with Find Post 302996203 by Corona688 on Friday 21st of April 2017 11:45:36 AM
Old 04-21-2017
Quote:
Originally Posted by royinfo.alain
I'm using the sed to replace .sf by .sfd.

Because at the end I want to backup file.sfd not file.sf

the .sf is used to find specific files and after that the sed is used to replace .sf to .sfd and I will loop in the result of the find (while) to verify if the file.sfd exist. If yes, this is the file that I want to backup (.sfd)

thanks
Hm. If .sf are files, there's no point using find here, since a simple loop will work just as good.

Code:
FILES=""
for FILE in *.sf
do
        FILE2="${FILE/.sf}".sfd
        [ -e "$FILE2" ] && FILE="$FILE2"
        # Add .sfd to list if exists, .sf if not
        FILES="$FILES $FILE"
done

echo tar -cf - $FILES


Last edited by Corona688; 04-21-2017 at 12:57 PM.. Reason: fix typo, file2/file
These 2 Users Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Solaris

Bar code generation in to the text file and printing the same using lp command.

Hi, I need the information regaring bar code printing. I am looking for the program which runs on solaris that take number string (like mobile number, bill number etc) as input and generate bar code font in to the text file. Remember it is not the bit map. The program just writes the fonts in to... (0 Replies)
Discussion started by: Manjunath Naik
0 Replies

2. UNIX for Advanced & Expert Users

How to use the command Tar to find a file

Hello, I am just using the command Tar to find if a file was backuped on my tape. Can you help me with that command. I am using the command : tar -tvf /dev/rmt/4m /kcc_dms/AC7/c15a* > toto.txt to find all files c15a* in these subdirectories on my tape. But it doesn't work correctly. Can... (2 Replies)
Discussion started by: steiner
2 Replies

3. UNIX for Advanced & Expert Users

How to restrict Core file generation after scp (of SSH) command executed in UNIX

Hi, I am getting core file in local machine after trasfer files to other machine by using scp (secure copy) of SSH in UNIX. Could any one please tell me how to restrict core file generatation by using scp command. (4 Replies)
Discussion started by: nrsekhar
4 Replies

4. AIX

command usage on find with xargs and tar

my task : tar up large bunch of files(about 10,000 files) in the current directories that created more than 30 days ago but it come with following error find ./ -ctime +30 | xargs tar rvf test1.tar tar: test1.tar: A file or directory in the path name does not exist. (3 Replies)
Discussion started by: darkrainbow
3 Replies

5. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

6. Shell Programming and Scripting

tar command dont tar to original directory

HI, if I have a tarfile called pmapdata.tar that contains tar -tvf pmapdata.tar -rw-r--r-- 0/0 21 Oct 15 11:00 2009 /var/tmp/pmapdata/pmap4628.txt -rw-r--r-- 0/0 21 Oct 14 20:00 2009 /var/tmp/pmapdata/pmap23752.txt -rw-r--r-- 0/0 1625 Oct 13 20:00 2009... (1 Reply)
Discussion started by: borderblaster
1 Replies

7. Shell Programming and Scripting

Dynamic command line generation with awk

Hi, I'm not an expert in awk but i need a simple script to do this: I'd like to AutoCrop PDF files. I found 2 simple script that combined together could help me to automatize :) The first utiliti is "pdfinfo" that it gives the MediaBox and TrimBox values from the pdf. The pdfinfo output... (8 Replies)
Discussion started by: gbagagli
8 Replies

8. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

9. Shell Programming and Scripting

find + tar + gzip + uunecode/email --> in one command?

How to search for all files with matching strings --> find + tar + gzip + uunecode/email them in one command? I am sure there is a right way to pass list of files to tar, then compress tar file. Then send that as attachment using uuencode in one command.. Can we do that!? (3 Replies)
Discussion started by: kchinnam
3 Replies

10. Shell Programming and Scripting

Single command - unzip files from a tar command

I have a tar file that contains multiple .Z files. Hence I need to issue a tar command followed by a gzip command to fully extract the files. How do I do it in a single command? What I'm doing now is tar xvf a.tar (this will output 1.Z and 2.Z) gzip -d *.Z (to extract 1.Z and 2.Z) (9 Replies)
Discussion started by: ericlim
9 Replies
PTM(4)							   BSD Kernel Interfaces Manual 						    PTM(4)

NAME
ptm -- pseudo-terminal multiplexor device SYNOPSIS
pseudo-device pty [count] DESCRIPTION
The ptm driver is the backend for the /dev/ptm device. It supports three ioctl(2)s. The first is TIOCPTMGET, which allocates a free pseudo- terminal device, sets its user ID to the calling user, revoke(2)s it, and returns the opened file descriptors for both the master and the slave pseudo-terminal device to the caller in a struct ptmget. This struct has the following content: struct ptmget { int cfd; int sfd; char cn[16]; char sn[16]; }; where cfd and sfd contain the master resp. slave device's file descriptor and cn and sn the corresponding paths in the file system. The /dev/ptmx device supports two more ioctl(2)s, TIOCGRANTPT, which is used by grantpt(3), TIOCPTSNAME, which is used by ptsname(3). The ptm device is included with the pseudo-device pty(4). It can be disabled by adding ``options NO_DEV_PTM'' to the kernel configuration. FILES
/dev/ptm ptm access device /dev/ptmx ptm cloning device, used to implement Unix98 ptys SEE ALSO
grantpt(3), openpty(3), posix_openpt(3), ptsname(3), unlockpt(3), pty(4) HISTORY
The /dev/ptm device appeared in OpenBSD 3.5 and was ported to NetBSD 3.0. BSD
November 12, 2005 BSD
All times are GMT -4. The time now is 10:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy