Maintaining file structure


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Maintaining file structure
# 1  
Old 06-05-2015
Maintaining file structure

Hi guys,

I am trying to store some output in a file and then compare it to another file.

I am gathering information from 2 commands:

Code:
cat /opt/jbin/server.log.tmp > A
grep "ephemeral" /opt/jbin/log/server.log.2015-05-02-18 > B

The contents of both file are the same. This means if I do a diff between A and B, I should get back nothing.

But doing a diff results in:


Code:
[user@server ~]$ diff A B
1c1,7
< 2015-06-02 18:00:40,262| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:00 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms 2015-06-02 18:01:40,266| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:01 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms 2015-06-02 18:02:40,268| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:02 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms 2015-06-02 18:03:40,270| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:03 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms 2015-06-02 18:04:40,272| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:04 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms 2015-06-02 18:05:40,277| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:05 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms 2015-06-02 18:06:40,279| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:06 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms
---
> 2015-06-02 18:00:40,262| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:00 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms
> 2015-06-02 18:01:40,266| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:01 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms
> 2015-06-02 18:02:40,268| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:02 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms
> 2015-06-02 18:03:40,270| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:03 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms
> 2015-06-02 18:04:40,272| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:04 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms
> 2015-06-02 18:05:40,277| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:05 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms
> 2015-06-02 18:06:40,279| ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1)|Unexpected error occurred in scheduled task.: com.amdocs.mfs.transit.exception.ExpiredEphemeralKeyRuntimeException: ephemeral key y8Ek3bINwRuBxufg5UsKm8xbQV1ZCeIh expired at 6/2/15 2:22 PM, evaluated against 6/2/15 6:06 PM with a time to live of 86,400,000 ms and clockDriftTolerance of 300,000 ms

Looks like a diff is occuring just because the structure of the file is different rather than contents being the same.

How can I manage to keep the structure of the file in tack ?
# 2  
Old 06-05-2015
If you sort the files before comparing, they will be in the same order and therefore identical.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 06-05-2015
Quote:
Originally Posted by Corona688
If you sort the files before comparing, they will be in the same order and therefore identical.
No. Sorting a file will not turn a single line in one file into seven lines in another file.

And, neither cat nor grep will split or combine lines. So..., the format of Junaid Subhani's two files (/opt/jbin/server.log.tmp and /opt/jbin/log/server.log.2015-05-02-18) is different; and cat and grep are not going to reformat those files to Junaid Subhani's unspecified desired file format.
This User Gave Thanks to Don Cragun For This Post:
# 4  
Old 06-06-2015
Are you sure file A is a true *nix text file and not contaminated with strange control chars from other OS?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Samba file structure

Hi, My manager asked me to create the same file structure in the new Redhat 6 server, using samba, with the one already used on the windows server for file sharing. For example, Parent Folder Child Folder Child Folder 2 and so on The issue now is that windows... (3 Replies)
Discussion started by: p2bas
3 Replies

2. Shell Programming and Scripting

SSH file redirection is not maintaining format

Hi, I'm running a script which would ssh to various ssh-trust enabled servers and get a list of packages installed. The output of this command would be redirected to a file ssh -q $i 'rpm -qa --queryformat '%{NAME}\t\t,%{ARCH}\t\t,%{VERSION}-%{RELEASE}\t\t,%{INSTALLTIME:date}\n'|sed... (2 Replies)
Discussion started by: maverick_here
2 Replies

3. Shell Programming and Scripting

Maintaining file currency

I have a common data folder with files like x* which is accessed by 3 unix servers. Now each server will try to pick one file form this folder and move it to its local folder. How to maintain file concurrency in this case?I dont want the same file to be accessed by more than one process. (2 Replies)
Discussion started by: prasperl
2 Replies

4. Red Hat

Copy certain file types recursively while maintaining file structure on destination?

Hi guys, I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash. I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also... (1 Reply)
Discussion started by: rockf1bull
1 Replies

5. UNIX for Dummies Questions & Answers

Maintaining HOURLY backups

I have a system where i take hourly back-ups of the system.The script for maintaining full backup for the last 5 days is find /backup/server -type f -mtime +4 -exec rm -f {} \; works fine for keeping the files of some 5 days old. In the case of hourly backups.How do we write to keep... (2 Replies)
Discussion started by: ravi55055
2 Replies

6. Programming

compare XML/flat file with UNIX file system structure

Before i start doing something, I wanted to know whether the approach to compare XML file with UNIX file system structure. I have a pre-configured file(contains a list of paths to executables) and i need to check against the UNIX directory structure. what are the various approches should i use ? I... (6 Replies)
Discussion started by: shafi2all
6 Replies

7. Programming

Search attributes in one structure using the values from another structure

Hello Groups I am trying to find out ways of comparing a value from a 'c' structure to a value in another 'C' structure. the 'C' structure can be a List or liked list as it contains lot many records. if we loop it in both the structures it is going to consume time. I am looking for a simple... (3 Replies)
Discussion started by: dhanamurthy
3 Replies

8. Shell Programming and Scripting

file structure

Hi, Is there a command that can help me to determain a unix file structure ? Thanks (7 Replies)
Discussion started by: yoavbe
7 Replies

9. UNIX for Dummies Questions & Answers

Copying a Directory Structure to a new structure

Hi all Is it possible to copy a structure of a directory only. e.g. I have a file with the following entries that is a result of a find :- /dir1/dir2/file.dbf /dir1/dir2/dir3/file1.dbf /dir1/file.dbf I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)
Discussion started by: jhansrod
8 Replies
Login or Register to Ask a Question