Sponsored Content
Top Forums Shell Programming and Scripting Using dirname on a file before uniq Post 302707259 by brsett on Friday 28th of September 2012 09:26:52 AM
Old 09-28-2012
Using dirname on a file before uniq

Hello,

I have a list of files generated like this:

Code:
find dir -type f > file_list

I want to get a list of just the unique directories. I can't create a temporary file. So the idea is to do a working equivalent to this:

Code:
cat file_list | dirname | uniq

But of course that doesn't even come close to working. For now, I'm looping thru the file, creating a \n seperated list of names ina variable, and running that thru uniq. Seems like there should be a clever one liner. Ideas?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Setting basename and dirname variable to simply script.

Hello all, Can somebody explain to me how set up a basename and dirname variable to simplify this script. I currently have a 'infile' with the contents of FTTPDataPVC_ & BaaisDSLFeed. I need to add a basename and or dirname variable so that any additions can be made through the infile and not... (1 Reply)
Discussion started by: liketheshell
1 Replies

2. UNIX for Dummies Questions & Answers

How to uniq third field in a file

Hi ; I have a question regarding the uniq command in unix How do I uniq 3rd field in a file ? original file : zoom coord 39 18652 39 18652 zoom coord 39 18653 39 18653 zoom coord 39 18818 39 18818 zoom coord 39 18840 39 18840 zoom coord 41 15096 41 15096 zoom... (1 Reply)
Discussion started by: babycakes
1 Replies

3. Shell Programming and Scripting

strip hostname from dirname?

I need to get the full path of a file minus the hostname... anyone have an easy way to do this? What I have is: //ourhostname/ourfullpath/filename What I need is: /ourfullpath/filename hostname evaluates to 'ourhostname' dirname evaluates to '//ourhostname/ourfullpath' basename... (2 Replies)
Discussion started by: tink
2 Replies

4. Shell Programming and Scripting

dirname, save cut portion to variable, clean up

Hi guys, last cry for help for today. I appreciate the help so far. ok so I have a program that dumps a path into my script as a variable ($1) This path is an example /home/xbmc/sab_downloads/video/tv/grey's anatomy/season 3 So in order to search thetvdb.com for a show, I need to extract... (6 Replies)
Discussion started by: tret
6 Replies

5. Programming

basename and dirname changes the value of argument???

Hi I faced with some interesting behavior of basename and dirname functions from libgen.h: they changes the value of argument! Here is the declaration: char *basename(char *); char *dirname(char *);It makes some tiresome to use them... I am new to C and maybe I do something wrong, but to... (4 Replies)
Discussion started by: Sapfeer
4 Replies

6. Shell Programming and Scripting

uniq the file content

Hi I want to uniq the content of a file based on 4th field a.txt abcd,123,456,234,asd defg,123,456,235,asd abcd,123,456,234,asd,lkjl,ijk ijkl,123,456,234,asd defg,123,456,235,asd,dfg,klm o/p will be like abcd,123,456,234,asd defg,123,456,235,asd ijkl,123,456,234,asd or ... (6 Replies)
Discussion started by: aaysa123
6 Replies

7. UNIX for Dummies Questions & Answers

Several file comparison not uniq or comm command

When comparing several files is there a way to find values unique to each file? File1 a b c d File2 a b t File 3 a (3 Replies)
Discussion started by: dr_sabz
3 Replies

8. UNIX for Advanced & Expert Users

$cat file|sort|uniq

I have a file with list of redundant server names and want only unique ones of those. I have used following command but still redudant ones are listing $cat file|sort|uniq where could be the problem. Thanks, Srinivas (3 Replies)
Discussion started by: srinivas Juluri
3 Replies

9. UNIX for Dummies Questions & Answers

$dirname ??????

Hi, okay, the following command was given to me in a script, but it's not working and there's little to no help on dirname. What is wrong with the following line? I'm just trying to save the current directory to use later in subsequent scripts. MYAPPDIR=$(dirname $(dirname $0)) Thanks. (2 Replies)
Discussion started by: rebazon
2 Replies

10. Shell Programming and Scripting

help with dirname

We are using #!/bin/sh From a command line this command returns the correct list of files (without going into any subdirectories) find /vol.prod/saptrans/common/test/pa/* -prune -type f -print We have a script which takes the same path as $1 (without the * ) ... (2 Replies)
Discussion started by: 15a0
2 Replies
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. Please notice this option isn't related to the terminal length as in a "80 culums terminal". --font=desc Set the font description. Default is Monospace 12. --rtl Do right to left (RTL) layout. --paper ps Choose paper size. Known paper sizes are legal, letter and A4. Default is A4. Postscript points Each postscript point equals to 1/72 of an inch. 36 points are 1/2 of an inch. --bottom-margin=bm Set bottom margin. Default is 36 postscript points. --top-margin=tm Set top margin. Default is 36 postscript points. --left-margin=lm Set left margin. Default is 36 postscript points. --right-margin=rm Set right margin. Default is 36 postscript points. --gutter-width=gw Set gutter width. Default is 40 postscript points. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 10:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy