Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Removing path name from list of file names Post 302587293 by kristinu on Wednesday 4th of January 2012 12:04:21 PM
Old 01-04-2012
Removing path name from list of file names

I have this piece of code

Code:
printf '%s\n' $pth*.msf | tr ' ' '\n' | sort -t '-' -k7 -k6r \
  | awk -F- '{c=($6$7!=p&&FNR!=1)?ORS:"";p=$6$7}{printf("%c%s\n",c,$0)}'

When I run it I get

Code:
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.002-8x6drw-csq.msf
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.004-8x6drw-csq.msf
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.006-8x6drw-csq.msf
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.008-8x6drw-csq.msf
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.010-8x6drw-csq.msf

/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.006-4x3drw-csq.msf

/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.002-16x12drw-csq.msf
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.004-16x12drw-csq.msf
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.006-16x12drw-csq.msf
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.008-16x12drw-csq.msf
/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.010-16x12drw-csq.msf

/home/chrisd/tatsh/branches/terr0.50/darwin/n02-z30-dsr65-terr0.50-dc0.008-8x6drw-tmy.msf

I want to remove the directory path /home/chrisd/tatsh/branches/terr0.50/darwin/ from this generated list
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can I delete files using a file that containt path and names?

Recentily i receive virus ninda and my network was files *.eml. I find all *.eml with: find / -name *.eml -print > virus Virus has the path and name of the file,so, How can i delete all *.eml? Thanks (2 Replies)
Discussion started by: AlvaroD
2 Replies

2. Shell Programming and Scripting

Removing duplicate files from list with different path

I have a list which contains all the jar files shipped with the product I am involved with. Now, in this list I have some jar files which appear again and again. But these jar files are present in different folders. My input file looks like this /path/1/to a.jar /path/2/to a.jar /path/1/to... (10 Replies)
Discussion started by: vino
10 Replies

3. Shell Programming and Scripting

How do manipulate file path and names

In emacs elisp, there is a handy function called file-name-nondirectory which accepts a path and file name and returns just a file name and extension. There is also a function called file-name-directory which just returns the dire ctory name without the file. How can I implement these same... (2 Replies)
Discussion started by: siegfried
2 Replies

4. Shell Programming and Scripting

want only file names (not whole path) in shell script

hi i wrote following script, #!/usr/bin/sh for index in `ls /tmp/common/*.txt` do echo "$index" done here index is giving full path but in my program i want only file names (not along with whole path) Eg. if in /tmp/common files are a.txt and b.txt den out should be a.txt b.txt ... (6 Replies)
Discussion started by: crackthehit007
6 Replies

5. Shell Programming and Scripting

List of file names

I have the following list of file names stored in $fnames, so that if I do foreach f ($fnames) echo "$f" end I will get n02-z30-sr65-rgdt0p50-dc0p002-16x12drw-run1 n02-z30-sr65-rgdt0p50-dc0p002-16x12drw-run2 n02-z30-sr65-rgdt0p50-dc0p002-16x12drw-run3... (3 Replies)
Discussion started by: kristinu
3 Replies

6. Shell Programming and Scripting

Removing files with same text but different file names

Hi All, I have some 50,000 HTML files in a directory. The problem is; some HTML files are duplicate versions that is wget crawled them two times and gave them file names by appending 1, 2, 3 etc after each crawl. For example, if the file index.html has been crawled several times, it has been... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

7. Shell Programming and Scripting

get file names from the list

Hi Experts, Here is my scenario: Am maintaining a file which has list of logs with complete path and file names like bleow a/b/c/Daily/file1_20111012.log d/e/f/Monthly/file1_20111001.log g/h/Daily/file1_20110120.log i/Daily/file1_20110220.log How to copy the file names frm the list... (7 Replies)
Discussion started by: laxm
7 Replies

8. Shell Programming and Scripting

Removing unknow chars from file names.

I'm trying to move a large folder to an external drive but some files have these weird chars that the external drive won't accept. Does anyone know any command of any bash script that will look through a given folder and remove any weird chars? (4 Replies)
Discussion started by: Joktaa
4 Replies

9. UNIX for Dummies Questions & Answers

[solved]removing characters from a mass of file names

I found a closed thread that helped quite a bit. I tried adding the URL, but I can't because I don't have enough points... ? Modifying the syntax to remove ! ~ find . -type f -name '*~\!]*' | while IFS= read -r; do mv -- "$REPLY" "${REPLY//~\!]}"; done These messages are... (2 Replies)
Discussion started by: rabidphilbrick
2 Replies

10. UNIX for Dummies Questions & Answers

List Directory names which have the file

Hi All, Can any one help me to list out the directory names which contain the specified file. See for example File name : file.201307014.LKT Have the directory structure as below. /app/work/data/INDIA/file.201307014.LKT /app/work/data/AMERICA/file.201307014.KTP... (5 Replies)
Discussion started by: Balasankar
5 Replies
bup-margin(1)						      General Commands Manual						     bup-margin(1)

NAME
bup-margin - figure out your deduplication safety margin SYNOPSIS
bup margin [options...] DESCRIPTION
bup margin iterates through all objects in your bup repository, calculating the largest number of prefix bits shared between any two entries. This number, n, identifies the longest subset of SHA-1 you could use and still encounter a collision between your object ids. For example, one system that was tested had a collection of 11 million objects (70 GB), and bup margin returned 45. That means a 46-bit hash would be sufficient to avoid all collisions among that set of objects; each object in that repository could be uniquely identified by its first 46 bits. The number of bits needed seems to increase by about 1 or 2 for every doubling of the number of objects. Since SHA-1 hashes have 160 bits, that leaves 115 bits of margin. Of course, because SHA-1 hashes are essentially random, it's theoretically possible to use many more bits with far fewer objects. If you're paranoid about the possibility of SHA-1 collisions, you can monitor your repository by running bup margin occasionally to see if you're getting dangerously close to 160 bits. OPTIONS
--predict Guess the offset into each index file where a particular object will appear, and report the maximum deviation of the correct answer from the guess. This is potentially useful for tuning an interpolation search algorithm. --ignore-midx don't use .midx files, use only .idx files. This is only really useful when used with --predict. EXAMPLE
$ bup margin Reading indexes: 100.00% (1612581/1612581), done. 40 40 matching prefix bits 1.94 bits per doubling 120 bits (61.86 doublings) remaining 4.19338e+18 times larger is possible Everyone on earth could have 625878182 data sets like yours, all in one repository, and we would expect 1 object collision. $ bup margin --predict PackIdxList: using 1 index. Reading indexes: 100.00% (1612581/1612581), done. 915 of 1612581 (0.057%) SEE ALSO
bup-midx(1), bup-save(1) BUP
Part of the bup(1) suite. AUTHORS
Avery Pennarun <apenwarr@gmail.com>. Bup unknown- bup-margin(1)
All times are GMT -4. The time now is 10:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy