Sponsored Content
Top Forums Shell Programming and Scripting Parsing a file that contains 2 types of delimeters Post 302120428 by Shell_Life on Wednesday 6th of June 2007 11:40:06 AM
Old 06-06-2007
Morgado,
See if this works for you:
Code:
cut -d';' -f1,2 input_file | sed 's/-.*;/ /' > output_file

 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

associated file types

I have a file of type .for extension .In a guui based unix environment like solaris if I double click on that file a specific program designed by me has to run which takes this file as the parameter and exceutes the program. Can anyone help me? (8 Replies)
Discussion started by: nhk_srd
8 Replies

2. Shell Programming and Scripting

Parsing a file that contains 2 types of delimeters

Now that I have a file that looks something like this; 20050926 Unknown 20050926 MUREXFO 20050926 MUREXFO 20050926 MUREXFO 20050926 Unknown 20050926 KADDUSS 20050926 KADDUSS 20050926 KADDUSS 20050926 MUREXFO Is there a way in vi that I can search the file and remove any line... (2 Replies)
Discussion started by: morgadoa
2 Replies

3. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

4. UNIX for Dummies Questions & Answers

Types of File in a directory

Hello, I have several thousand files with different extensions in a directory. Is there a single command to get what the various extensions are with a single command. Thanks for your help! Best, Guss (2 Replies)
Discussion started by: Gussifinknottle
2 Replies

5. Shell Programming and Scripting

Reading a FLAT File - No Delimeters

Hi Folks, I have a file without any delimeters and it is a flat file. Example, my raw data looks: x25abcy26defz27ghi..... Now, could you please any one help me to program to split this into variable and create a text file. I want a output as below Name Age Number x 25 abc... (14 Replies)
Discussion started by: Jerald Nathan
14 Replies

6. 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

7. Shell Programming and Scripting

How to delete lines having unmatched delimeters in a file?

Hi, I have a delimited (|) file having millions of rows. Sometime the file comes with less number of delimiters than expected. In this scenario I want to delete the row having unmatched delimiters. Can anyone help me with the command to achieve this? Ex: File1.txt 8039339595113|JIMMY... (2 Replies)
Discussion started by: satyaatcgi
2 Replies

8. Shell Programming and Scripting

Cp -r except certain file types

the following excludes certain directories successfully cp -r probe/!(dir) /destination I want to exclude certain file types and tried unsuccessfully cp -r probe/!(*.avi) /destination (2 Replies)
Discussion started by: tmf
2 Replies

9. Shell Programming and Scripting

List file types

Hello everyone - I have a task of listing files from a directory together with their type. I tried using ls -l | file -b or different versions of that but that did not work. I will need this to be in a C shell script that will list the file name, size and type from a directory. I can do... (12 Replies)
Discussion started by: adrianvas12
12 Replies

10. Shell Programming and Scripting

Sort file based on number of delimeters in line

Hi, Need to sort file based on the number of delimeters in the lines. cat testfile /home/oracle/testdb /home /home/oracle/testdb/newdb /home/oracle Here delimeter is "/" expected Output: /home/oracle/testdb/newdb /home/oracle/testdb /home/oracle /home (3 Replies)
Discussion started by: Sumanthsv
3 Replies
uniq(1) 						      General Commands Manual							   uniq(1)

NAME
uniq - report repeated lines in a file SYNOPSIS
fields] chars] [input_file [output_file]] DESCRIPTION
reads the input text file input_file, comparing adjacent lines, and copies the result to output_file. If input_file is not specified, the standard input and standard output are used. If input_file is specified, but output_file is not, results are printed to standard output. input_file and output_file must not be the same file. Line-Comparison Options recognizes the following options when comparing adjacent lines: Print those lines that are repeated in the original file. Print copy only of each repeated line in the input file. Generate an output report in default style except that each line is preceded by a count of the number of times it occurred. If this option is specified, the and options are ignored if either or both are also present. If none of the options or are present, prints the results of the union of the and options, producing a copy of the original input file with the second and succeeding copies of any repeated lines removed. (Note that repeated lines must be adjacent in order to be found -- see sort(1)). Field-Skip Options Two options are provided for skipping an initial portion of each line when making comparisons: Ignore the first fields fields, together with any blanks before each. fields is a positive decimal integer. A field is defined as a string of non-space, non-tab characters separated by tabs and/or spaces from its neighbors. Ignore the first chars characters. chars is a positive decimal integer. Each line in the input is assumed to be terminated with a new line character for purposes of comparison. Fields are skipped before characters. EXTERNAL INFLUENCES
Environment Variables must be equal to the value it had when the input files were sorted. determines the interpretation of text within files as single- and/or multi-byte characters, and defines a space character when the or option is used. determines the language in which messages are displayed. If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty variable. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multi-byte character code sets are supported. RETURN VALUE
Exit values are: 0 Successful completion. >0 Error condition occurred. AUTHOR
was developed by OSF and HP. SEE ALSO
comm(1), sort(1). STANDARDS CONFORMANCE
uniq(1)
All times are GMT -4. The time now is 09:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy