Sponsored Content
Top Forums Programming How to open hidden file and converted into .dat format? Post 302984283 by avi1991nash on Monday 24th of October 2016 05:13:36 AM
Old 10-24-2016
How to open hidden file and converted into .dat format?

Here i am having ".tmideg0"hidden file .
I have made programm but it doesnot work
Code:
#!/usr/bin/perl




$runDir = $ENV{"REGR_RUN_DIR"};
@files = (<*.tmideg0> <*.tmideg1>);

foreach $FILE (@files)
{
open (IN, $FILE) || die "Couldn't open $FILE for reading";
open (OUT, ">$runDir/$FILE.dat") || die "Couldn't open $FILE for reading";

while(<IN>) {
    print OUT $_;
}
}
close(IN);
close(OUT);

---------- Post updated at 02:43 PM ---------- Previous update was at 11:09 AM ----------

here i am having code
in which it convert all ".txt" file to ".txt.dat" file but i want ".dat file" how to do it.

Code:
#!/usr/bin/perl

$runDir = $ENV{"REGR_RUN_DIR"};
@files = (<*.txt>);

foreach $FILE (@files)
{
open (IN, $FILE) || die "Couldn't open $FILE for reading";

open (OUT, ">$runDir/$FILE.dat") || die "Couldn't open $FILE for reading";

while(<IN>) {
    print OUT $_;
}
}
close(IN);
close(OUT);

Moderator's Comments:
Mod Comment edit by bakunin: since Don Cragun has edited in the missing CODE-tags for you, you have appended your original post, AGAIN NOT USING CODE-TAGS! How often, do you think. we need to ask you to use them until this bears fruit?

Last edited by bakunin; 10-24-2016 at 08:21 AM.. Reason: Add CODE tags.
 

9 More Discussions You Might Find Interesting

1. Linux

How to open a .DAT video file in LINUX

:confused: Hai guys!!!! I am using Mandrake Linux 10.1 with Intel P4 system.. I don't know how to open .DAT video file in LINUX. Please help me! (1 Reply)
Discussion started by: mahi3699
1 Replies

2. Solaris

/etc/format.dat file currupt

What we have to do when the /etc/format.dat file is corrupted? (3 Replies)
Discussion started by: lbreddy
3 Replies

3. UNIX for Dummies Questions & Answers

List all directories hidden or not hidden

I want to list all directories hidden or not hidden. ls -ld */ => shows only not hidden directories so i guess the answer would be to add the a option to show all files ls -lad */ => not working :confused: ls -la | grep "^d" => works But I would like to know why I can't use ls -lad... (4 Replies)
Discussion started by: servus
4 Replies

4. UNIX for Dummies Questions & Answers

How to Open a data format file?

Hi, Am having a file. I checked that file format by the following command file filename Output is filename: data So the file is data format file Am trying to view that file so i have used some commands like cat,more so on but it showing the contents like compressed form(full of Symbols). How... (4 Replies)
Discussion started by: Adhi
4 Replies

5. Shell Programming and Scripting

Tar to decompress and to convert file to .dat format

tar -tvf abc.tar.gz gives me the file name abc.Is it possible to rename the file to abc.dat while decompressing using tar ? Thanks. (2 Replies)
Discussion started by: vedanta
2 Replies

6. Shell Programming and Scripting

Date format change in UNIX .dat file

Hi, I need help to convert the date format in .DAT file in unix. I want to convert 10@@|SWIFT MT568 Extract@@|Apr 14 2014 5:47:52:563PM@@|Apr 14 2014 4:33:47:663PM@@||##| into 10@@|SWIFT MT568 Extract@@|04/14/2014/ 5:47:52:563PM@@|04/14/2014 4:33:47:663PM@@||##| Appreciate... (18 Replies)
Discussion started by: karthikengox
18 Replies

7. Programming

Python Results Converted To C Struct Header File

I created python code that produce output in the form of: moses-red-sea=1.00.03 genesis-snake=2.03 deliverance=5.0.010 I need to take this output and create a "C" header file and have it look like this: struct { char *name; char *fixed_version; } filename_versions... (7 Replies)
Discussion started by: metallica1973
7 Replies

8. Shell Programming and Scripting

How to use 'ls' command to list files like *.dat, not *.*.dat?

How to use 'ls' command to list files like *.dat, not *.*.dat (5 Replies)
Discussion started by: pmcginni777
5 Replies

9. Shell Programming and Scripting

Rsync - how to copy hidden folder or hidden files when using full path

Hello. I use this command : rsync -av --include=".*" --dry-run "$A_FULL_PATH_S" "$A_FULL_PATH_D"The data comes from the output of a find command. And no full source directories are in use, only some files. Source example... (2 Replies)
Discussion started by: jcdole
2 Replies
ferror(3C)																ferror(3C)

NAME
ferror, feof, clearerr, fileno - stream status inquiries SYNOPSIS
#include <stdio.h> int ferror(FILE *stream); int feof(FILE *stream); void clearerr(FILE *stream); int fileno(FILE *stream); The ferror() function returns a non-zero value when an error has previously occurred reading from or writing to the named stream (see intro(3)). It returns 0 otherwise. The feof() function returns a non-zero value when EOF has previously been detected reading the named input stream. It returns 0 otherwise. The clearerr() function resets the error indicator and EOF indicator to 0 on the named stream. The fileno() function returns the integer file descriptor associated with the named stream; see open(2). See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ open(2), intro(3), fopen(3C), stdio(3C), attributes(5), standards(5) 17 Feb 2005 ferror(3C)
All times are GMT -4. The time now is 02:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy