Sponsored Content
Top Forums Shell Programming and Scripting How to extract first column with a specific character Post 302198010 by selamba_warrior on Thursday 22nd of May 2008 04:59:56 AM
Old 05-22-2008
Dear era,

Thanks. It work.

Actually i'm looking to the first command:

sed -n 's/^\(I\).*/\1/p' file

Can u explain on this?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

change character(s) in specific column

Hi all! I need to change the final e every time when it is present in any word in column 1 to a; moreover, to change the final i again to a in any word in column 1, but just if word in column 2 begins with ha or si. Here below you can see a sample of my data: achwa ungeliachwa ungeli 1... (3 Replies)
Discussion started by: mjomba
3 Replies

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

3. Shell Programming and Scripting

remove special character from a specific column

Hello , i have a text file like this : A123 c12AB c32DD aaaa B123 23DS 12QW bbbb C123 2GR 3RG cccccc i want to remove the numbers from second and third column only. i tried this : perl -pe 's///g' file.txt > newfile.txt but it will remove the number from... (7 Replies)
Discussion started by: shelladdict
7 Replies

4. Shell Programming and Scripting

How to replace a character in a specific column in a file?

This is a file that I have test line 1 (55) ) test line 2 (45) ) I would like to change all the parens in position 1 of this file to a ); i only want to check position 1 in every line of the file. I have tried different varations of sed, but cannot seem to be able to limit it to... (1 Reply)
Discussion started by: JoeG
1 Replies

5. Shell Programming and Scripting

Extract lines with unique value using a specific column

Hi there, I need a help with extracting data from tab delimited file which look like this #CHROM POS ID REF ALT Human Cow Dog Mouse Lizard chr2 3033 . G C 0/0 0/0 0/0 1/1 0/0 chr3 35040 . G T 0/0 0/0 ./. 1/1 0/1 chr4 60584 . T G 1/1 1/1 0/1 1/1 0/0 chr10 7147815 . G A 0/0 1/1 0/0 0/0... (9 Replies)
Discussion started by: houkto
9 Replies

6. Shell Programming and Scripting

Extract values from a specific column to the end

Hello friends, I have a text file with many columns (no. columns vary from row to row) separated by space. I need to collect all the values from 18th column to the end from each line and group them as pairs and then numbering like below.. 1. 18th-col-value 19th-col-value 2. 20th-col-value ... (5 Replies)
Discussion started by: prvnrk
5 Replies

7. Shell Programming and Scripting

[Solved] Extract First character in fourth column

Hi Experts, I am new to UNIX. One of my file records are like below 220 IN C/A 515013 NULL NULL 220 IN C/A 515017 NULL NULL 225 IN C/A 333701 NULL NULL 225 IN C/A 515034 NULL NULL 225 IN C/A 499201 NULL NULL 225 IN C/A 499202 NULL NULL The above mentioned records delimiter is... (4 Replies)
Discussion started by: suresh_target
4 Replies

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

9. Linux

Removing a character at specific position in a column

Hi, I have a file like this (about 8 columns in total, this being the 2nd column) gi_49482297_ref_YP_039521.1_ gi_49482297_ref_YP_039521.1_ gi_49482315_ref_YP_039539.1_ gi_49482315_ref_YP_039539.1_I want to remove the _ at the end of the line. And at later stages I would want to replace the... (5 Replies)
Discussion started by: Syeda Sumayya
5 Replies

10. UNIX for Beginners Questions & Answers

How do I extract specific column in multiple csv files?

file1: Name,Threshold,Curr Samples,Curr Error%,Curr ART GETHome,100,21601,0.00%,47 GETregistry,100,21592,0.00%,13 GEThomeLayout,100,30466,0.00%,17 file2: Name,Threshold,Curr Samples,Curr Error%,Curr ART GETHome,100,21601,0.00%,33 GETregistry,100,21592,0.00%,22... (6 Replies)
Discussion started by: Raghuram717
6 Replies
ckpath(1)							   User Commands							 ckpath(1)

NAME
ckpath, errpath, helppath, valpath - display a prompt; verify and return a pathname SYNOPSIS
ckpath [-Q] [-W width] [-a | l] [-b | c | f | y] [-n [o | z]] [-rtwx] [-d default] [-h help] [-e error] [-p prompt] [-k pid [-s signal]] /usr/sadm/bin/errpath [-W width] [-a | l] [-b | c | f | y] [-n [o | z]] [-rtwx] [-e error] /usr/sadm/bin/helppath [-W width] [-a | l] [-b | c | f | y] [-n [o | z]] [-rtwx] [-h help] /usr/sadm/bin/valpath [-a | l] [-b | c | f | y] [-n [o | z]] [-rtwx] input DESCRIPTION
The ckpath utility prompts a user and validates the response. It defines, among other things, a prompt message whose response should be a pathname, text for help and error messages, and a default value (which is returned if the user responds with a RETURN). The pathname must obey the criteria specified by the first group of options. If no criteria is defined, the pathname must be for a normal file that does not yet exist. If neither -a (absolute) or -l (relative) is given, then either is assumed to be valid. All messages are limited in length to 79 characters and are formatted automatically. Tabs and newlines are removed after a single white space character in a message definition, but spaces are not removed. When a tilde is placed at the beginning or end of a message defini- tion, the default text is inserted at that point, allowing both custom text and the default text to be displayed. If the prompt, help or error message is not defined, the default message (as defined under EXAMPLES) is displayed. Three visual tool modules are linked to the ckpath command. They are errpath (which formats and displays an error message on the standard output), helppath (which formats and displays a help message on the standard output), and valpath (which validates a response). OPTIONS
The following options are supported: -a Pathname must be an absolute path. -b Pathname must be a block special file. -c Pathname must be a character special file. -d default Defines the default value as default. The default is not validated and so does not have to meet any criteria. -e error Defines the error message as error. -f Pathname must be a regular file. -h help Defines the help message as help. -k pid Specifies that process ID pid is to be sent a signal if the user chooses to quit. -l Pathname must be a relative path. -n Pathname must not exist (must be new). -o Pathname must exist (must be old). -p prompt Defines the prompt message as prompt. -Q Specifies that quit is not allowed as a valid response. -r Pathname must be readable. -s signal Specifies that the process ID pid defined with the -k option is to be sent signal signal when quit is chosen. If no signal is specified, SIGTERM is used. -t Pathname must be creatable (touchable). Pathname will be created if it does not already exist. -w Pathname must be writable. -W width Specify that prompt, help and error messages be formatted to a line length of width. -x Pathname must be executable. -y Pathname must be a directory. -z Pathname must have a file having a size greater than zero bytes. OPERANDS
The following operand is supported: input Input to be verified against validation options. EXAMPLES
The text of the default messages for ckpath depends upon the criteria options that have been used. Example 1 Default prompt An example default prompt for ckpath (using the -a option) is: example% ckpath -a Enter an absolute pathname [?,q] Example 2 Default error message An example default error message (using the -a option) is: example% /usr/sadm/bin/errpath -a ERROR: A pathname is a filename, optionally preceded by parent directories. The pathname you enter: - must begin with a slash (/) Example 3 Default help message An example default help message (using the -a option) is: example% /usr/sadm/bin/helppath -a A pathname is a filename, optionally preceded by parent directories. The pathname you enter: - must begin with a slash (/) Example 4 The quit option When the quit option is chosen (and allowed), q is returned along with the return code 3. Quit input gets a trailing newline. Example 5 Using the valpath module The valpath module will produce a usage message on stderr. It returns 0 for success and non-zero for failure. example% /usr/sadm/bin/valpath usage: valpath [-[a|l][b|c|f|y][n|[o|z]]rtwx] input . . . EXIT STATUS
The following exit values are returned: 0 Successful execution. 1 EOF on input, or negative width on -W option, or usage error. 2 Mutually exclusive options. 3 User termination (quit). 4 Mutually exclusive options. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
signal.h(3HEAD), attributes(5) SunOS 5.11 4 Nov 2005 ckpath(1)
All times are GMT -4. The time now is 06:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy