Sponsored Content
Top Forums Shell Programming and Scripting Converting windows format file to unix format using script Post 302482210 by Chubler_XL on Tuesday 21st of December 2010 12:00:19 AM
Old 12-21-2010
Quote:
Originally Posted by cero
Another way would be to use the file-command:
Code:
for f in *
do
   ft=$(file $f)
   if [ "$ft" = "$f: ASCII text" ]
   then
       # do your stuff here
   fi
done

Agreed using file is a good option, but be carefull as the output of file is pretty system specific and you code may not work on another OS or updated version of your OS.

On my OS DOS format files are reported by file as:
Code:
test: ASCII text, with CRLF line terminators

While unix formatted files are reported as:
Code:
test_unix:ASCII text

And zip files appear as:
Code:
test.zip: Zip archive data

 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Converting BMP to BM (or other unix format)

Hey pllz, ive got a little problem, i want to convert a bmp of gif or jpg to an unix format (bm) anybody got any suggestions ? greets\EJ (1 Reply)
Discussion started by: EJ =)
1 Replies

2. Programming

converting unix timestamp into readable format using c++

hi everyone, im new here and am in desperate need of help. I want to convert my 32 bit unix time stamp ' 45d732f6' into a readable format (Sat, 17 February 2007 16:53:10 UTC) using c++. I have looked around the interent but i just cant make sense of anything. All examples i can find just... (3 Replies)
Discussion started by: uselessprog
3 Replies

3. Shell Programming and Scripting

Converting file format

My input file is Pipe delimited with 10 fields, I am trying to create a tab delimited output file with 6 fields from the provided input file. Below is sample data Input file abc||2|PIN|num||||www.123.com|abc@123.com| bcd||2|PIN|num|||||abc@123.com|... (3 Replies)
Discussion started by: pasupuleti81
3 Replies

4. UNIX for Dummies Questions & Answers

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (1 Reply)
Discussion started by: Samtel
1 Replies

5. Shell Programming and Scripting

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (2 Replies)
Discussion started by: Samtel
2 Replies

6. Shell Programming and Scripting

Script for converting a pdf to book format

Hello, excuse my English... I'm trying to do a nautilus-script to transform a normal A4 pdf to another pdf with book format, ready to be printed (double sided). I mean, the script put pages in order and also put 2 pages per horizontal A4 page (p.e.: a pdf with 8 pages would look like: 8-1, 2-7,... (2 Replies)
Discussion started by: dokan
2 Replies

7. Shell Programming and Scripting

Script for converting a pdf to book format: an update

With reference to , the script posted by dokan fails via a Bash syntax error because my version of pdftk 1.41 has multiple lines matching to "Num", which are stored in the TOTAL variable. If we modify the first non-ignored line of the script from # Original TOTAL=$( pdftk "$1" dump_data output |... (1 Reply)
Discussion started by: aldebrn
1 Replies

8. UNIX for Dummies Questions & Answers

converting scripts from dos 2 unix format

Hi, I am new to shell scripting and exploring it , I have developed few sample shell script but I have developed them on windows xp notepad and then saving them on folder and then testing them on cywgin and running perfectly...but these scripts are in dos format and I want to convert them in unix... (1 Reply)
Discussion started by: rahul125
1 Replies

9. Shell Programming and Scripting

Need help in converting the file format

Hi All, I need help in converting the mentioned file format into desired output format using awk. Could anyone help me in this? Below is the input.. Date Account Campaign AdGroup Keyword Conversion Revenue Var1 Var2 Var3 Var4 Var5 10 20 30 ... (8 Replies)
Discussion started by: Ravi S M
8 Replies

10. UNIX for Dummies Questions & Answers

help required in converting a file format

My file format: -------------------------------------------------- Complete Consistency Check Valid Area : VALID:VALID Started by : esanwad Started at : Thu Dec 11 16:04:46 2014 CNA version : R21H04_EC08 Check range : AREA VALID/VALID ... (4 Replies)
Discussion started by: Gautam Banerjee
4 Replies
AdvanceCOMP ZIP Compression Utility(1)			      General Commands Manual			    AdvanceCOMP ZIP Compression Utility(1)

NAME
advzip - AdvanceCOMP ZIP Compression Utility SYNOPSIS
advzip [-a, --add] [-x, --extract] [-l, --list] [-z, --recompress] [-t, --test] [-0, --shrink-store] [-1, --shrink-fast] [-2, --shrink-normal] [-3, --shrink-extra] [-4, --shrink-insane] [-N, --not-zip] [-p, --pedantic] [-q, --quiet] [-h, --help] [-V, --version] ARCHIVES... [FILES...] DESCRIPTION
The main purpose of this utility is to recompress and test the zip archives to get the smallest possible size. For recompression the 7-Zip (www.7-zip.com) Deflate implementation is used. This implementation generally gives 5-10% more compression than the zLib Deflate implementation. For experimental purpose also the 7-Zip LZMA algorithm is available with the -N option. In this case, the generated zips WILL NOT BE USABLE by any other program. To make them usable you need to recompress them without the -N option. Generally this algorithm gives 10-20% more compression than the 7-Zip Deflate implementation. OPTIONS
-a, --add ARCHIVE FILES... Create the specified archive with the specified files. You must specify only one archive. -x, --extract ARCHIVE Extract all the files on the specified archive. You must specify only one archive. -l, --list ARCHIVES... List the content of the specified archives. -z, --recompress ARCHIVES... Recompress the specified archives. If the -1, -2, -3 options are specified, it's used the smallest file choice from: the previous compressed data, the new compression and the uncompressed format. If the -0 option is specified the archive is always rewritten without any compression. -t, --test ARCHIVES... Test the specified archives. The tests may be extended with the -p option. -N, --not-zip Use the LZMA algorithm when compressing. The generated zips will not be readable by any other application! -p, --pedantic Be pedantic on the zip tests. If this flag is enabled some more extensive tests on the zip integrity are done. These tests are gen- erally not done by other zip utilities. -0, --shrink-store Disable the compression. The file is only stored and not compressed. This option is very useful to expand the archives of .png and .mp3 files. These files are already compressed, trying to compress them another time is really a waste of time and resource. -1, --shrink-fast Set the compression level to "fast". -2, --shrink-normal Set the compression level to "normal". This is the default level of compression. -3, --shrink-extra Set the compression level to "extra". -4, --shrink-insane Set the compression level to "insane". COPYRIGHT
This file is Copyright (C) 2002 Andrea Mazzoleni, Filipe Estima SEE ALSO
advpng(1), advmng(1), advdef(1) AdvanceCOMP ZIP Compression Utility(1)
All times are GMT -4. The time now is 01:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy