Sponsored Content
Top Forums Shell Programming and Scripting How to extract every 6-th character in a line? Post 303026162 by RudiC on Wednesday 21st of November 2018 03:50:46 AM
Old 11-21-2018
Not much that we can work with. In WHAT way above "is not working properly"? And, please answer post#2!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Extract a character

HI Guys, Have a Doubt...... I have a pattern "abcdef" and i need to extract the third character..ie(c) How to achieve it? (10 Replies)
Discussion started by: aajan
10 Replies

2. Shell Programming and Scripting

extract character + 1

Hi, I would like extract from a file a character or pattern after ( n + 1) a specific pattern (n) . ( i supposed with awk) how could i do ? Thanks in advance. (1 Reply)
Discussion started by: francis_tom
1 Replies

3. HP-UX

How to remove new line character and append new line character in a file?

Hi Experts, I have data coming in 4 columns and there are new line characters \n in between the data. I need to remove the new line characters in the middle of the row and keep the \n character at the end of the line. File is comma (,) seperated. Eg: ID,Client ,SNo,Rank 37,Airtel \n... (8 Replies)
Discussion started by: sasikari
8 Replies

4. Shell Programming and Scripting

Extract character between specific line numbers

Hi guys, I have txt file and I would need to extract all the contents between specific line numbers. Line 1: apple Line 2: orange Line 3: mango Line 4: grapes Line 5: pine apple I need to extract the content between line 2 and 4, including the contents of Line 2 and 4 so the ouput... (2 Replies)
Discussion started by: gowrishankar05
2 Replies

5. Shell Programming and Scripting

Extract a character specifying position

hi , i am having a file Full_ARTMAS_20110510152425.xml in my local directory. i wanted to extract the character at the 35143546 th position at line 1 of this file.Can any body help me how to do it??? regards Anjali (2 Replies)
Discussion started by: angel12345
2 Replies

6. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

7. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

I have hundreds of files to process. In each file I need to look for a pattern then extract value(s) from next line and then search for value(s) selected from point (2) in the same file at a specific position. HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

8. Shell Programming and Scripting

Sed: delete on each line before a character and after a character

Hi there, A total sed noob here. Is there a way using sed to delete everything before a character AND after another character on each line in a file? The deletion should also delete the indicating characters(here: an opening and a closing parenthesis). The original file would look like... (3 Replies)
Discussion started by: bnbsd
3 Replies

9. Shell Programming and Scripting

Extract First character in Second column

Hi, I need to extract the first character of second column of my file. If the condition matches, then I need to print the 2nd and 3rd column as my output I tried below mentioned query but it was not working awk -F'|' '$2~/^5/' Sgn_group.txt File Name : Sgn_group.txt country... (2 Replies)
Discussion started by: suresh_target
2 Replies

10. Shell Programming and Scripting

Read character by character in line in which space is also included

Hi friend, I have one file , and i want to read that file character by character. I need this script in ksh. while using read option with -n1 am getting error. while read -n1 c read has bad option And if i am using below script, then if in a line has space like this ( Pallvi mahajan)... (10 Replies)
Discussion started by: pallvi_mahajan
10 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 12:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy