Sponsored Content
Top Forums UNIX for Advanced & Expert Users File command return wrong filetype while file holds group separator char. Post 302905962 by drl on Monday 16th of June 2014 09:51:17 AM
Old 06-16-2014
Hi.

The definition of how file decides on filetype is:
Code:
     The type printed will usually contain one of the words text (the file
     contains only printing characters and a few common control characters and
     is probably safe to read on an ASCII terminal), executable (the file con‐
     tains the result of compiling a program in a form understandable to some
     UNIX kernel or another), or data meaning anything else (data is usually
     ‘binary' or non-printable).  Exceptions are well-known file formats (core
     files, tar archives) that are known to contain binary data.

from man file, q.v.

One could create one's own file command and add the GS control character as an exception -- I have not done it, but I think the file magic could be so changed. Otherwise, one could replace the GS (say with sed) to something innocuous before feeding the resulting copy of the data file to the file commend.

Best wishes ... cheers, drl
 

10 More Discussions You Might Find Interesting

1. Programming

CHAR Array - stuffed with values - with more size than it holds

Hi All I am simulating a problem in the production where i faced a situation. Please find the following example program which i simulated. #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char str1; (3 Replies)
Discussion started by: dhanamurthy
3 Replies

2. Shell Programming and Scripting

need shell script to get last 10 char from a file name and write in to a new file

i have no idea abount shell script but i need need shell script to get last 10 char from a file name and write in to a new file. consider u hav 5 files in a particular dir i script should get last 10 char of each file n write the 10 char in separate files (2 Replies)
Discussion started by: raj0390
2 Replies

3. Shell Programming and Scripting

Sort the file contents in each group....print the group title as well

I've this file and need to sort the data in each group File would look like this ... cat file1.txt Reason : ABC 12345-0023 32123-5400 32442-5333 Reason : DEF 42523-3453 23345-3311 Reason : HIJ 454553-0001 I would like to sort each group on the last 4 fileds and print them... (11 Replies)
Discussion started by: prash184u
11 Replies

4. Shell Programming and Scripting

A variable is including the Carriage Return char...

Hi all, I'm reading a file with this layout: First_Col Second_Col The Second_Col has values as 1000, -1, 10, 43... While reading the file I'm getting the second column value with awk command, but it is including the CR control char. do item_saved=`echo $b | awk '{print... (4 Replies)
Discussion started by: mrreds
4 Replies

5. Programming

how to return the char in C?

hi I have the below code to convert hexa to binary. It is working fine, but i want to store the binary in char or int. The below program is printing the result. void ConvertHexToBinary(char sHexValue) { int i; printf("Binary Equivalent="); for(i=0;sHexValue!=NULL;i++) { ... (1 Reply)
Discussion started by: atharalikhan
1 Replies

6. Shell Programming and Scripting

Why sed command deletes last line in a file if no carriage return?

Hi I am using sed command to make SCORE=somevalue to SCORE=blank in a file. Please see the attached lastline.txt file. After executing the below command on the file, it removes the last line. cat lastline.txt | sed 's/SCORE=.*$/SCORE=/g' > newfile.txt Why does sed command remove the... (3 Replies)
Discussion started by: ashok.k
3 Replies

7. Shell Programming and Scripting

need a one liner to grep a group info from /etc/group and use that result to search passwd file

/etc/group tiadm::345:mk789,po312,jo343,ju454,ko453,yx879,iy345,hn453 bin::2:root,daemon sys::3:root,bin,adm adm::4:root,daemon uucp::5:root /etc/passwd mk789:x:234:1::/export/home/dummy:/bin/sh po312:x:234:1::/export/home/dummy:/bin/sh ju454:x:234:1::/export/home/dummy:/bin/sh... (6 Replies)
Discussion started by: chidori
6 Replies

8. Shell Programming and Scripting

Change everything in a file that maps to {module::name.filetype} to _modules/name/applicat

path = content.txt filename = application directory = _modules define create $(eval from := $(shell echo $$1)) \ $(eval to := $(shell echo $$2)) \ sed -i '' 's/$(from)/$(to)/g' content.txt endef all: clear $(eval modules := $(shell egrep -o "{module+\}" $(path))) ... (1 Reply)
Discussion started by: bmson
1 Replies

9. Shell Programming and Scripting

Add unique identifier from file to filetype in directory

I am trying to add a unique identifier to two file extensions .bam and .vcf in a directory located at /home/cmccabe/Desktop/index/R_2016_09_21_14_01_15_user_S5-00580-9-Medexome. The identifier is in $2 of the input file. What the code below is attempting to do is strip off the last portion... (21 Replies)
Discussion started by: cmccabe
21 Replies

10. UNIX for Advanced & Expert Users

Replace \n char true line Separator

Unix File is pipe delimited with 17 fields. We may get extra pipes in data also. We may get \n char (1 or more \n in one field or multi fileds) in data in any field. Need to replace \n true ( line separator) with 'space and bell char space' chars (' \a ') Not data \n. Input:... (1 Reply)
Discussion started by: rajeshkumare
1 Replies
NET(5)								File Formats Manual							    NET(5)

NAME
net - format of .net files read/written by Magic's netlist editor DESCRIPTION
Netlist files are read and written by Magic's netlist editor in a very simple ASCII format. The first line contains the characters `` Netlist File'' (the leading blank is important). After that comes a blank line and then the descriptions of one or more nets. Each net contains one or more lines, where each line contains a single terminal name. The nets are separated by blank lines. Any line that is blank or whose first character is blank is considered to be a separator line and the rest of its contents are ignored. Each terminal name is a path, much like a file path name in Unix. It consists of one or more fields separated by slashes. The last field in the path is the name of a label in a cell. The other fields (if any), are cell instance identifiers that form a path from the edit cell down to the label. The first instance identifier must name a subcell of the edit cell, the second must be a subcell of the first, and so on. Instance identifiers are unique within their parent cells, so a terminal path selects a unique cell to contain the label. However, the same label may appear multiple times within its cell. When this occurs, Magic assumes that the identical labels identify electrically equivalent terminals; it will choose the closest of them when routing to that terminal. Further, after connecting to one of these termi- nals Magic may take advantage of the internal wiring connecting them together and route through a cell to complete the net's wiring. An example netlist file follows below. It contains three distinct nets. ---------------------------------------- Netlist File alu/bit_1/cout alu/bit_2/cin regcell[21,2]/output latch[2]/input This line starts with a blank, so it's a separator. opcode_pla/out6 shifter/drivers/shift2 ---------------------------------------- SEE ALSO
magic(1) 4th Berkeley Distribution NET(5)
All times are GMT -4. The time now is 01:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy