Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to retrieve original contents of a modified file (modified using vi) Post 302119486 by novice100 on Wednesday 30th of May 2007 06:33:19 AM
Old 05-30-2007
how to retrieve original contents of a modified file (modified using vi)

Made changes to a file using vi editor and saved those changes

now realised that the changes are not required

How can I get the previous version of the file.i.e the one which was there on which I had made changes
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I get the last modified date of a file?

I am trying to load a group of files and their last dates modified into a text file that will in turn be used with SQL*Loader to load these files into Oracle. I am using a *.ksh script. I am getting the name of the file in by using the following: for file_ext in 'cat loaddir.ext'; do find... (2 Replies)
Discussion started by: akpopa
2 Replies

2. Programming

File last modified

I cannot read the last moment the file was modified - it returns "Most recent access" instead: code: </td> <th><?FILE *fatr=fopen(iindname.c_str(), "r"); if(fatr){ struct stat statbuf; fstat(fileno(fatr), &statbuf); fclose(fatr); ?> ... (4 Replies)
Discussion started by: szzz
4 Replies

3. Shell Programming and Scripting

Check if file modified

Hi, I have a monitoring script that I run, and I would like to automate checking if specific parameter file is modified during the last day or two. How do I do that? (1 Reply)
Discussion started by: nimo
1 Replies

4. UNIX for Dummies Questions & Answers

who modified my file!!

Hi EVERYONE!!... Just a simple (yet critical from my perspective) doubt... I would like to know who had edited my file.. when I use ls -l command, I see my ID.. but when I edit using some other ID, I had expected that ID to be shown.. but still ls -l shows my ID only.. So, is there any... (4 Replies)
Discussion started by: mohanprabu
4 Replies

5. Shell Programming and Scripting

How to get a filename modified by attaching modified timestamp

Hi, I want to modify a filename in AIX by attaching the last modified timestamp. I want the timestamp completely in numerical format (eg:200905081210. yr-2009, mnth - 05, date -08, hr - 12, mins - 10). For example if the filename is a.log and it was modified on April 6th 2008 at 21.00. I... (16 Replies)
Discussion started by: Ruks
16 Replies

6. Shell Programming and Scripting

How long since file has been modified

how can I find out if a file has been modified less than 24hrs ago (3 Replies)
Discussion started by: BeefStu
3 Replies

7. Shell Programming and Scripting

How to find a file modified more than once

Hi All, How to find a file modified more than once.... Thanks in advance (2 Replies)
Discussion started by: kmsekhar
2 Replies

8. UNIX for Dummies Questions & Answers

The original AF counter that has yet to be modified.

Hi guys... This was my original attempt at the AF Frequency Counter for the AudioScope.sh project... #!/bin/bash # Set the startup values... data="?" freq=0 number="" subscript=0 waveform=0 # An initial screen... clear printf "\nA simple 50 Hz to 3500 Hz audio frequency... (2 Replies)
Discussion started by: wisecracker
2 Replies

9. UNIX for Advanced & Expert Users

Who has modified a file - History?

Hello, I'd want to know who and what time has modified a file in unix (history). I'd like to know all people who has modified a file. Thanks in advance (6 Replies)
Discussion started by: nurinolo
6 Replies

10. UNIX for Dummies Questions & Answers

Is original file modified when pigz is interrupted?

I had to stop a pigz (parallel gzip) compression before it completed. Is the original uncompressed file changed/corrupted? I was under the impression that the original file is not changed during compression, though it is deleted if the compression is successful. (1 Reply)
Discussion started by: colin123
1 Replies
DtEditorSaveContentsToFile(library call)								  DtEditorSaveContentsToFile(library call)

NAME
DtEditorSaveContentsToFile -- save the contents of a DtEditor widget to a file SYNOPSIS
#include <Dt/Editor.h> DtEditorErrorCode DtEditorSaveContentsToFile( Widget widget, char *fileName, Boolean overwriteIfExists, Boolean hardCarriageReturns, Boolean markContentsAsSaved); DESCRIPTION
The DtEditorSaveContentsToFile function saves the entire contents of the DtEditor widget to a file, optionally replacing soft line feeds (word wraps) with <newline>s. If the file does not exist and the directory has the correct write permissions, the file is created. If the file exists and the overwriteIfExists argument is set to True, the contents of the file are overwritten. If the file or its directory does not have the correct write permissions, an error is returned. The DtEditor widget tracks whether its contents have changed since they were last saved or retrieved. If the markContentsAsSaved argument is set to False, a copy of the data is saved without affecting whether DtEditorCheckForUnsavedChanges(3) reports that there are unsaved changes. This is useful if the application needs to save a copy of the contents to a temporary file. The widget argument specifies the DtEditor widget ID. The fileName argument is the pathname of the file relative to the local system. The overwriteIfExists argument, if set to True, causes DtEditorSaveContentsToFile to save the widget contents even though the file speci- fied by the fileName argument exists and has correct write permissions. If this argument is set to False, DtEditorSaveContentsToFile returns DtEDITOR_WRITABLE_FILE. The hardCarriageReturns argument, if set to True, indicates that the widget should replace any soft line feeds (word wraps) with <newline>s when saving the data. When this argument is set to False, any line wrapped because it reaches the right edge of the window, is saved as one complete line. The markContentsAsSaved argument, when set to True, causes the DtEditor widget to mark that all changes made to date have been saved. When this argument is set to False, the DtEditor widget does not change its status regarding unsaved changes. If an error arises during the save, the status does not change, regardless of the value of the markContentsAsSaved argument. For a complete definition of the DtEditor widget and its associated resources, see DtEditor(3). RETURN VALUE
Upon successful completion, the DtEditorSaveContentsToFile function returns DtEDITOR_NO_ERRORS; otherwise, if it cannot save the data to the file, the function returns one of the following values: DtEDITOR_INVALID_FILENAME No file was specified. DtEDITOR_UNWRITABLE_FILE The application does not have write permission for the file or directory. DtEDITOR_CHAR_SPECIAL_FILE The file is a device-special file. DtEDITOR_BLOCK_MODE_FILE The file is a block-mode device. DtEDITOR_NO_FILE_ACCESS The file cannot be accessed. DtEDITOR_SAVE_FAILED The contents could not be saved for an unspecified reason. DtEDITOR_WRITABLE_FILE The named files exist and the overwriteIfExists argument is set to False. EXAMPLES
The following code segment saves the contents of a DtEditor widget to the local file, Foo, substituting <newline>s for soft line feeds. It also indicates that all changes to the contents of the widget have been saved. Widget editor; DtEditorErrorCode status; char *fname = "Foo"; Boolean overwrite = False, hardReturns = True, markContentsAsSaved = True; status = DtEditorSaveContentsToFile(editor, fname, overwrite, hardReturns, markContentsAsSaved); switch(status) { case DtEDITOR_NO_ERRORS: break; case DtEDITOR_WRITABLE_FILE: printf("Save failed. The file already exists. "); break; default: printf("Could not save contents. "); break; } APPLICATION USAGE
The application should use DtEditorGetContents(3) to retrieve the data in a memory buffer, rather than a disk file. SEE ALSO
Dt/Editor.h - DtEditor(5), DtEditor(3), DtEditorAppend(3), DtEditorAppendFromFile(3), DtEditorCheckForUnsavedChanges(3), DtEditorGetCon- tents(3), DtEditorInsert(3), DtEditorInsertFromFile(3), DtEditorReplace(3), DtEditorReplaceFromFile(3), DtEditorSetContentsFromFile(3), DtEditorSetContents(3). DtEditorSaveContentsToFile(library call)
All times are GMT -4. The time now is 04:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy