[bash] How to uniq files in a file list with paths?

Hi folks,
I know I can get rid of duplicate entries in a list by sorting and uniqing:
sort file | uniq
But how can I uniq filenames in a file list with paths?
/foo/abc.bar
/foo/def.bar
/foo/bar/def.bar
/foo/ghi.bar
Is it necessary to write my own comparison routine like “output thisline if basename(thisline) != basename(lastline)” (would require a basename-sorted input list)?

arith wrote:
Hi folks,
I know I can get rid of duplicate entries in a list by sorting and uniqing:
sort file | uniq
Or 'sort -u':
$ cat test
a
e
b
d
c
a
d
$ sort -u test
a
b
c
d
e
arith wrote:
But how can I uniq filenames in a file list with paths?
/foo/abc.bar
/foo/def.bar
/foo/bar/def.bar
/foo/ghi.bar
Is it necessary to write my own comparison routine like “output thisline if basename(thisline) != basename(lastline)” (would require a basename-sorted input list)?
I came up with
$ cat test
/home/karol/test/test0
/home/karol/test/test/test0
/home/karol/test/foo/test00
/home/karol/test/foo/bar/test0
/home/karol/test/foo/bar/test1
/home/karol/test1
$ awk -F/ '{print $F" "$NF}' test | sort -k2 | uniq --skip-fields=1 | awk '{print $1}'
/home/karol/test/foo/bar/test0
/home/karol/test/foo/test00
/home/karol/test/foo/bar/test1
but I think there's a better way to do it ;P

Similar Messages

  • How  to integrate File Server with Portal??

    Hi all,
    can any one tell me that how interegate the File Server With Portal Server??
    In my portal server under home tab i have sub tab (second level navigation) of File server.Whe i click this tab it throws an syntax error
    ie
    System Error
    An exception occurred during the program execution. Below you will find technical information pertaining to this exception that you might want to forward to your system administrator.
    Exception Class  :: class com.sapportals.wcm.repository.NotSupportedException
    Exception Message  :: Not Implemented
    thease are the steps that i have taken
    >created HTTP System..
    >created WebDAV Repository.
    >Created Cache.
    >Created KM WebDAV System.
    >Created Iview and in iview i have to specify the <b>Path to Initially Displayed Folder</b>
    i have specified the folder of file server that i want to display..
    but i get the same syntax error ..
    infact i dint get that folder in KM.
    But when i specify the folder that is present in KM its Work fine..
    Now the Scnerio According to me is that File server is not integrated properly
    if it would be integrated properly i would be able to see the folder of File server in  KM...
    am i correct ??
    please Guide me to integrated the File Server Properly??
    Points will be given for any help..
    Regards
    Vinit

    Hi Vinit,
    if you want some Windows File Server integrated into Portal, please do not use a WebDAV Repository, but use the File System Repository instead. Therefore you need to configure the according Repository Manager. Please refer to this documentation:
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/ed/b334ea02a2704388d1d2fc3e4298ad/frameset.htm">Integrating Documents from a Windows System into KM</a>
    HTH,
    Carsten

  • How to use File Adapter with hierarchial Structure?

    Hi,
    How to use File Adapter with hierarchial Structure like..
    Data:
    --Header Details:
    Line Item Details:
    Data
    Bcoz I am getting a Flatfile in a hierarchial way as shown below.
    Header Details :1
    Line Item a
    Line Item b
    Header Details :2
    Line Item c
    Line Item d
    Kishore

    Hey Kishore,
    In order to create a structure you need to use the file with convertion mode on the sending communication channel of the file adapter.
    check the link for the needed configuration paramters.
    If the structure is more complexed you can use the Contetnt master(CM) from itemfield which allows to ceate XML file from complex flat files and more.
    <a href="http://help.sap.com/saphelp_erp2005/helpdata/en/0d/5ab43b274a960de10000000a114084/frameset.htm">File sender adapter</a>
    If you have any question i'll be more than happy to assist.
    Nimrod Gisis

  • How can I file share with another person if both of us are using Mac operating systems?  Do we need to use a third party file sharing system or does apple have this capability?

    How can I file share with another personif both of us are using Mac operating systems (one of us using a Mac laptop and the other using iMac).  Our intention is to have a working document that can be changed by both parties over time and both parties will have visibility to the others changes.

    Use SugarSync

  • How to do file validation with ODI 10.1.3.5

    Hi Team,
    Please help me, how to handle file validation with ODI?
    My source is files.
    Requirement:
    With ODI i have to do the file validation and file data loading successfully. Once it is successfully done then i have to move the particular file and move to different directory.
    Any internal tool is there in ODI package to watch the file.
    Regards,
    Suresh

    Hi Suresh,
    You can do your file loading and validation in an ODI interface.
    Once you are done with the interface, add it to a package, you can set up subsequent steps in the package to move the file to another location using the built in ODI file utilities in the package.
    Terrence.

  • FM for getting teh file name with path

    Hi guys,
    Is there an fm getting the file name with path given the physical path and file name? Thanks!

    Hi Mark,
    Function Module WS_FILENAME_GET is obsolete, dont use it.
    Use the Method file_open_dialog of  class cl_gui_frontend_services as given below.
    DATA:
        lt_filetable TYPE filetable,
        lf_rc        TYPE i,
        lv_filename(50) TYPE c,
        lv_fileext(3) TYPE c,
        ls_file TYPE file_table,
        lv_file TYPE localfile,
        lv_title TYPE string.
      lv_title = sy-title.
      lv_progname = sy-cprog.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = lv_title
          file_filter             = '*.txt'
          multiselection          = abap_false
        CHANGING
          file_table              = lt_filetable
          rc                      = lf_rc
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          not_supported_by_gui    = 4
          OTHERS                  = 5.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                   DISPLAY LIKE 'E'
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        EXIT.
      ENDIF.
    * Number of selected filed must be equal to one.
      CHECK lf_rc = 1.
    * Access selected file
      READ TABLE lt_filetable INTO ls_file INDEX 1.
      CHECK sy-subrc = 0.
      lv_file = ls_file-filename.
      SPLIT lv_file AT '.' INTO lv_filename lv_fileext.
    Revert back if you need clarifications.
    Regards
    Karthik D

  • How do i sync windows 7 contact list with iphone

    How do I sync Windows 7  contact list with iphone?

    If both computers are running Lion the easiest way would be to sign up for a free iCloud account and let Apple do it for you via the cloud.

  • How do I combine my iphone contact list with my laptop pc contact list?  And how does it handle duplicates with different information?

    How do I combine my iphone contact list with my laptop pc contact list? And how does it handle duplicates that have different information?
    How do I merge my iphone calendar appointments/alerts with my laptop pc calendar appointments/alerts?  And how does it handle duplicates?
    I do not need anything to change on my email that is working fine on both.

        gspielman,
    Help has arrived to assist you with getting those contacts on both your devices. The Verizon cloud service is definitely a great tool to use and you can also use Apple iCloud as well. When you sign into the Verizon cloud on your iPad does it give an option or message to restore?
    CandiceH_VZW
    Follow us on Twitter @VZWSupport

  • How to Disable File Listing of UCM Content in WebCenter

    Hi Experts,
    We have a WebCenter custom portal application integrate with UCM. UCM hosts all static HTMLs, images, files for download, etc and WebCenter is provided the following link to access the html, images, etc.
    http://host/PortalApp/content/conn/UCM_Connection/path/Contribution Folders/web/Public/images/some_image.gif
    We notice that if we access http://host/PortalApp/content/conn/UCM_Connection/path/Contribution Folders/web/Public/images/ in browser, it provides full file listing and Up one folder link for viewer to navigate the full structure.
    Our question is simple how to disable this behavior but we found nowhere in the documentation / google / forum have answer to this. So hope the experts here can answer, thanks.
    Best Regards,
    Ziho

    No, I am not using Webtier. The content listing is the UCM content structure, not physical file structure. And the UI obviously is rendered by WebCenter with WebCenter image resource http://host/PortalApp/adf/webcenter/uponefolder_qualifier.png.
    Edited by: Ziho on 2011年4月19日 上午1:43

  • How change the File Open With list of apps?

    In Bridge CS3, how does one edit the list of applications in the File > Open With menu (also available from the contextual menu for any image).
    The list contains a number of applications that I would never use to open an image, and I would like to add to it, a new image editor (pixelmator) that does not appear in it. I have looked in the Bridge Help and the Preferences dialog and don't see any option to do this.

    OK, I have now learned that Mac OS keeps the list of which apps to open what, in the "launch services database."
    This database can be cleaned up and reset which somewhat simplifies the list that is displayed by the Finder OR by Bridge CS3.
    Here is an article on how to reset the launchdb:
    http://www.macosxhints.com/article.php?story=20031215144430486
    Be sure to read all the way to the end as there are updated instructions down among the comments.
    Here is a thread in the Apple Support forums discussing the same issue, and it includes links to some 3rd-party programs that can reset launch services without use of a lengthy Terminal command:
    http://discussions.apple.com/thread.jspa?messageID=1289317
    Even after rebuilding the launchdb, I find that a large number of apps are "registered" to open JPG files, including Camino, Opera, TextWrangler and others with only a tenuous connection to JPG. I don't understand why this is, and I would still like to find a way to limit the JPG Open-With list to a few graphics programs. But cleaning up the launchdb as described in the linked pages, did get rid of some programs and added some missing ones.
    Hope this actually constructive info is useful to others.
    Dave Cortesi

  • How to place file names with thumbnails?

    I have several thousand images that need to go online but I cannot for the life of me figure out how to add file names to the thubnails. Every bit of documentation I've read talks about adding it to the larger images only. I figured that part out but can't I have file names for the thumbnails too?

    Bummer. I was hoping for a secret key to take me there. I have too 
    many images that can be scanned via thumbnails and for the detail 
    shots they can go larger. There is no way I can use this as it is with 
    9000+ images that need to be gone through quickly. Thanks for the 
    answer.
    Mark

  • How to sort file list by time

    I have saved many PDF files from my mails - when I want to open (Adobe Reader on Samsung tablet) the file last saved I have no possibility find it simply by sorting file list by time - (list is fixed by name only) - how to change list order?.

    Sorting by time could be based on documents'
    (a) Date/Time created
    (b) Date/Time modified
    (c) Date/Time last opened / accessed
    Adobe Reader for Android shows (c) in Recents.
    (Click the image above to enlarge)
    The last opened PDF document appears at the top.  Please note that it is not customizable - meaning that you (as a user) cannot change the sorting criteria.

  • How to identify files associated with apps?

    Hello all -
       I am considering buying a new Mac mini which would come with Yosemite.  My existing mini (mid 2011, Lion 10.7.5) has a lot of apps I do not wish to migrate, so I think I am stuck with manually reinstalling each of the apps I want on the new computer.  How do I identify the necessary files associated with these apps (preferenes, app support, etc.) so I can copy them over after reinstalling on the new computer?  Is there any way to track what files were installed along with the app when it was first installed?  Anyone familiar with the claim of CleanApp to log all associated files with an installation (at time of install), or any other software that does this?
       Thanks - Randy

    Thanks again Arthur for your response.  I looked at RoaringApps but was not sure if I should enable the real time or just use basic.  Real time seems to require a lot of downloading (and modification?)   What do you recommend - Real TIme or Basic?
    As far as SunnyMenu, it is old but has worked flawlessly through and including Lion 10.7.5.  The only alteration of the system is that it is added as a startup item in my User in System Preferences.  It does not change the GUI, but adds menus (that you can customize) in addition to, rather than changing what System X does.  The Dock will not accomodate nearly as many items and SunnyMenu allows for nested subfolders of menu items.  I find it extremely useful and use it every day. I realize one day it will no longer work, but hope that, as it's pretty simple, that may be a bit further off.  As a rule I don't dabble in System modifiying stuff like maintenance, clean-up, speed-up, "optimization" etc. and just rely on System X.  I do have iStat Menus, but I don't believe that's modifying the System, but only displays information.  RoaringApps seems to indicate it's compatible with everything through Yosemite.  Would you recommend against that as well?  It saved me once when my fan failed but I noticed the iStat temp & rpm display and got it repaired at my Apple Store before I completely toasted my mini.
    Thanks again for your replies, they have been extrmely helpful in understanding how to start planning my move to a new Mac mini with Yosemite!

  • Selecting Multiple File Types With Path Control

    My application uses a file path control for the user to specify an output file.  This output file can have two different formats (.csv or .mbf) which is unknown until the user specifies it through the file dialogue.  However, when the user inputs a file name with a .mbf extension (test.mbf, for example), the file path control automatically appends the typed-in name with a .csv extension (test.mbf.csv).  Given that the Pattern field on the control is written like this: *.csv; *.mbf., it seems that the control is simply taking the first file pattern listed and appending it to whatever is typed into the File Name field in the file dialogue box.  Selection Mode is set to "Files" and "New or existing".
    Anyone know a way to smarten up the file control to recognize the appropriate file type?
    Using LabVIEW 8.6.1.
    Thanks!
    Andrew
    Solved!
    Go to Solution.

    Instead of using the file path control, try using the Fial Dialog Express VI. This will bring up the same dialog box but will allow you much more flexibility. Replace your file path control with a button ("Specify Path" in my example code):

  • How to create and handle sharepoint custom list with more than 300 columns?

    Hi,
    I have requirement for our project where in the input form is having around 320 columns in it.below are the columns and data types.
    Single line of text-180
    Yes or No Radio button -95
    Date time control-35
    Checkbox-10
    I have checked the sharepoint boundry and limits for columns and data types.
    https://technet.microsoft.com/en-us/library/cc262787.aspx
    But how can we handle a sharepoint list with these many large number columns.
    Is it safe to create all columns in a single list?
    How it will impact the performance?
    What is the other approach acheive this requirement?
    Any help would be appreciated.
    Regards,
    Poovi

    Hi,
    According to your description, my understanding is that you want to know if it has some performance issue and limitation when create large number column in a list.
    When creating columns in the list , you can still create all 320 columns in the list. But when retrieve the items in a view, then there is a list view threshold limit which causes the performance issue, see the link below:
    Sharepoint list column limit
    To handling the large number columns, I suggest you can distinguish the column with business logic to create in different list, it will be clear to display the logic relationship.
    Thanks
    Best Regards,
    Jerry Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

Maybe you are looking for