Sponsored Content
Full Discussion: Cutting a tab delimiter file
Top Forums Shell Programming and Scripting Cutting a tab delimiter file Post 302148034 by matrixmadhan on Thursday 29th of November 2007 01:39:43 PM
Old 11-29-2007
Code:
awk -F"\t" '{ for ( i=1; i<=10; i++ ) { printf "%s\t", $i } printf "\n"; }' filename

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cutting columns if delimiter has more than one charecter

Hi, My file looks like abc$%sdfhs$%sdf$%sdfaf$% here as seen delimiter is $%...now how cas i take out second field as cut command expect delimiter as single charecter only.....is there is any other way thanks and regards mahabunta (9 Replies)
Discussion started by: mahabunta
9 Replies

2. UNIX for Dummies Questions & Answers

Cutting a portion of a line seperated by pipe delimiter

Hi, In the below line a|b|10065353|tefe|rhraqs|135364|5347575 dgd|rg|4333|fhra|grhrt|46423|urdsgd Here i want to cut the characters in between the second and third pipe delimiter and then between fifth and sixth delimiter and retain the rest of the line. My output should be ... (3 Replies)
Discussion started by: ragavhere
3 Replies

3. Shell Programming and Scripting

append data in a file by using tab delimiter

Hi, I need to append the data in to a file by using tab delimiter. eg: echo "Data1" >> filename.txt echo "\t" >> filename.txt (its not working) echo "Data2" >> filename.txt. the result sould be like this. Data1 Data2 (6 Replies)
Discussion started by: Sharmila_P
6 Replies

4. UNIX for Dummies Questions & Answers

Delimiter: Tab or Space?

Hello, Is there a direct command to check if the delimiter in your file is a tab or a space? And how can they be converted from one to another. Thanks, G (4 Replies)
Discussion started by: Gussifinknottle
4 Replies

5. UNIX for Dummies Questions & Answers

cutting columns if delimiter has more than one charecter (|^)

Hi All, I am having a file with the delimiter '|^'. File name:test_dlim.csv I want to cut the first field of this using awk command. I tried with the help of the following link:... (2 Replies)
Discussion started by: boopathyvasagam
2 Replies

6. Shell Programming and Scripting

Cutting a part of line till delimiter

here are the few scenarios... isoSizeKB text NOT NULL, reserved1 varchar(255), KEY `deviceId` (`deviceId`) `d5` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `dHead` enum('HistoryInfo','Diversion') COLLATE utf8_unicode_ci, `ePR` int(11) DEFAULT '0', PRIMARY KEY (`id`) ... (7 Replies)
Discussion started by: vivek d r
7 Replies

7. UNIX for Dummies Questions & Answers

Making a Tab delimiter file to Comma

How can i make a tab delimiter file to a comma delimiter??? (13 Replies)
Discussion started by: saggiboy10
13 Replies

8. Shell Programming and Scripting

Compare two tab-delimiter files

Hi, I have two files like: file1 chr1 40 chr1 50 chr2 10 chr2 60 file2 chr1 30 chr1 50 chr2 15 chr2 20 and want to get the difference of column 2 when column 1 is the same in both files. (4 Replies)
Discussion started by: linseyr
4 Replies

9. Shell Programming and Scripting

Cutting a string using more than one character as delimiter

Hi , I have a set of files in a folder which i need to cut in to two parts.... Sample files touch AE_JUNFOR_2014_MTD_2013-05-30-03-30-02.TXT touch AE_JUNFOR_2014_YTD_2013-05-30-03-30-02.TXT touch temp_AE_JUNFOR_2014_MTD_2013-05-30-03-30-02.TXT touch... (4 Replies)
Discussion started by: chillblue
4 Replies

10. Shell Programming and Scripting

Cutting values with delimiter

Hi All, I have a string with , delimiter america,finland,netherlands Now i want these values to be stored in file as below with newline character at end of each value america finland netherlands Regards Prasad (3 Replies)
Discussion started by: krishna_gnv
3 Replies
cut(1)							      General Commands Manual							    cut(1)

NAME
cut - cut out (extract) selected fields of each line of a file SYNOPSIS
list [file]... list [file]... list char] [file]... DESCRIPTION
cuts out (extracts) columns from a table or fields from each line in a file; in data base parlance, it implements the projection of a rela- tion. Fields as specified by list can be fixed length (defined in terms of character or byte position in a line when using the or option), or the length can vary from line to line and be marked with a field delimiter character such as the tab character (when using the option). can be used as a filter; if no files are given, the standard input is used. When processing single-byte character sets, the and options are equivalent and produce identical results. When processing multi-byte char- acter sets, when the and options are used together, their combined behavior is very similar, but not identical to the option. Options Options are interpreted as follows: list A comma-separated list of integer byte option), character option), or field option) numbers, in increasing order, with optional to indicate ranges. For example: Positions 1, 4, and 7. Positions 1 through 3 and 8. Positions 1 through 5 and 10. Position 3 through last position. Cut based on a list of bytes. Each selected byte is output unless the option is also specified. Cut based on character positions specified by list extracts the first 72 characters of each line). Where list is a list of fields assumed to be separated in the file by a delimiter character (see for example, copies the first and seventh field only. Lines with no field delimiters will be passed through intact (useful for table sub- headings), unless is specified. The character following is the field delimiter option only). Default is tab. Space or other characters with special meaning to the shell must be quoted. Adjacent field delimiters delimit null fields. char may be an international code set character. Do not split characters. If the high end of a range within a list is not the last byte of a character, that character is not included in the output. However, if the low end of a range within a list is not the first byte of a character, the entire character is included in the output." Suppresses lines with no delimiter characters when using option. Unless is specified, lines with no delimiters appear in the output without alteration. Hints Use to extract text from a file based on text pattern recognition (using regular expressions). Use to merge files line-by-line in columnar format. To rearrange columns in a table in a different sequence, use and See grep(1) and paste(1) for more information. EXTERNAL INFLUENCES
Environment Variables determines the interpretation of text as single and/or multi-byte characters. If 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 vari- able. 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 supports both single- and multi-byte character code sets. International code set characters may be specified in the char given to the option. recognizes the international code set characters according to the locale specified in the environment variable. EXAMPLES
Password file mapping of user ID to user names: Set environment variable to current login name: Convert file containing lines of arbitrary length into two files where contains the first 500 bytes (unless the 500th byte is within a multi-byte character), and contains the remainder of each line: DIAGNOSTICS
Line length must not exceed characters or fields, including the new-line character (see limits(5). Missing or option or incorrectly specified list. No error occurs if a line has fewer fields than the list calls for. list is empty. WARNINGS
does not expand tabs. Pipe text through expand(1) if tab expansion is required. Backspace characters are treated the same as any other character. To eliminate backspace characters before processing by use the or com- mand (see fold(1) and col(1)). AUTHOR
was developed by OSF and HP. SEE ALSO
grep(1), paste(1). STANDARDS CONFORMANCE
cut(1)
All times are GMT -4. The time now is 07:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy