Sponsored Content
Top Forums Shell Programming and Scripting File ordering by portion of filename Post 302317434 by Ygor on Tuesday 19th of May 2009 02:41:15 AM
Old 05-19-2009
If the last modification timestamp matches the file name then just use ls -t.
Otherwise try something like...
Code:
ls *.xml | awk -F _ '{print $NF "\t" $0}' | sort | cut -f2-

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Match portion of the filename

hi, I have a script which accept filename and process them, however, one of the file needs 'special' handling so I need to identify it, say the filename contains the word "STOCK" (i.e. NEWYORKSTOCKLIST20060627.txt), I want to check if the filename contains the word "STOCK", how can I do that?... (1 Reply)
Discussion started by: mpang_
1 Replies

2. Programming

Delete Portion of a file

hi i would like to know whether i can delete a part of a file in C for eg. if my file contained 1234567890 and i want to delete 456 so that it becomes 1237890 is there a way i can do this. well, one way i can achieve this is by creating a new file, copy whatever i want, then delete the... (2 Replies)
Discussion started by: sameersbn
2 Replies

3. UNIX for Dummies Questions & Answers

Portion of a file in a new files

Hi, I need to devide one file into 3 files based on column numbers and put a string (FILE1, FILE2, FILE3) in the last..... Input file: Column1,Column2,Column3,Column4,Column5,Column6,Column7,Column8,Column9,Column10 Output1: Column1,Column3,Column6,Column4,Column5,FILE1 Output2:... (6 Replies)
Discussion started by: yale_work
6 Replies

4. Shell Programming and Scripting

extract string portion from filename using sed

Hi All, I posted something similar before but I now have a another problem. I have filenames as below TOP_TABIN240_20090323.200903231830 TOP_TABIN235_1_20090323.200903231830 i need to extract the dates as in bold. Using bash v 3.xx Im trying to using the print sed command but... (11 Replies)
Discussion started by: santam
11 Replies

5. Shell Programming and Scripting

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
3 Replies

6. Shell Programming and Scripting

ordering a data file

With an input file like this: How can I get an output like this? (In the quoted examples, the "_" sign represents an empty space) Note that there are some minus signs and no spaces, in the example above the first character of the first line is an empty space, so each number spans 10... (16 Replies)
Discussion started by: lego
16 Replies

7. Shell Programming and Scripting

Cutting out text from specific portion on filename

Hi, how do I go about cutting out the first numeric characters after the word "access"? access1005101228.merged-00.15.17.86.d8.b8.log.gz (16 Replies)
Discussion started by: GermanJulian
16 Replies

8. Shell Programming and Scripting

Unix Scripting : Sort a Portion of a File and not the complete file

Need to sort a portion of a file in a Alphabetical Order. Example : The user adam is not sorted and the user should get sorted. I don't want the complete file to get sorted. Currently All_users.txt contains the following lines. ############## # ARS USERS ############## mike, Mike... (6 Replies)
Discussion started by: evrurs
6 Replies

9. Shell Programming and Scripting

Extracting a portion of the filename

Hi I would like to extract the first portion of filename from a list of files. The filename pattern is of the form 123456789_TEXT_TEXT_TEXT_.csv. I want to extract just the numerical portion of this filename from the list of files and then output this into another text file. K (6 Replies)
Discussion started by: kamal_p_99
6 Replies

10. UNIX for Dummies Questions & Answers

How to append portion of a file content to another file when a certain pattern is matching?

Hi ladies and gentleman.. I have two text file with me. I need to replace one of the file content to another file if one both files have a matching pattern. Example: text1.txt: ABCD 1234567,HELLO_WORLDA,HELLO_WORLDB DCBA 3456789,HELLO_WORLDE,HELLO_WORLDF text2.txt: XXXX,ABCD... (25 Replies)
Discussion started by: bananamen
25 Replies
CRM_DIFF(8)							  [FIXME: manual]						       CRM_DIFF(8)

NAME
crm_diff - identify changes to the cluster configuration and apply patches to the configuration files SYNOPSIS
crm_diff [-?|-V] [-o filename] [-O string] [-p filename] [-n filename] [-N string] DESCRIPTION
The crm_diff command assists in creating and applying XML patches. This can be useful for visualizing the changes between two versions of the cluster configuration or saving changes so they can be applied at a later time using cibadmin. OPTIONS
--help, -? Print a help message. --original filename, -o filename Specify the original file against which to diff or apply patches. --new filename, -n filename Specify the name of the new file. --original-string string, -O string Specify the original string against which to diff or apply patches. --new-string string, -N string Specify the new string. --patch filename, -p filename Apply a patch to the original XML. Always use with -o. --cib, -c Compare or patch the inputs as a CIB. Always specify the base version with -o and provide either the patch file or the second version with -p or -n, respectively. --stdin, -s Read the inputs from stdin. EXAMPLES
Use crm_diff to determine the differences between various CIB configuration files and to create patches. By means of patches, easily reuse configuration parts without having to use the cibadmin command on every single one of them. 1. Obtain the two different configuration files by running cibadmin on the two cluster setups to compare: cibadmin -Q > cib1.xml cibadmin -Q > cib2.xml 2. Determine whether to diff the entire files against each other or compare just a subset of the configurations. 3. To print the difference between the files to stdout, use the following command: crm_diff -o cib1.xml -n cib2.xml 4. To print the difference between the files to a file and create a patch, use the following command: crm_diff -o cib1.xml -n cib2.xml > patch.xml 5. Apply the patch to the original file: crm_diff -o cib1.xml -p patch.xml FILES
/var/lib/heartbeat/crm/cib.xml--the CIB (minus status section) on disk. Editing this file directly is strongly discouraged. SEE ALSO
??? AUTHOR
crm_diff was written by Andrew Beekhof. [FIXME: source] 07/05/2010 CRM_DIFF(8)
All times are GMT -4. The time now is 02:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy