Sponsored Content
Top Forums Shell Programming and Scripting Remove 5th character from Field1 & Print Post 302150309 by vino on Tuesday 11th of December 2007 01:08:12 AM
Old 12-11-2007
Quote:
Originally Posted by Raynon
Hi Vino,

Tried using your code but there's some error.
Can you help ?
My bad. I have corrected the sed statement.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can we use 'tr' command to print 5th column of output of 'ls -l'

Hi All, I know awk command can do it, but can we use tr command to print 5th column of out put 'ls -l' command???? Regards, Nidhi... (4 Replies)
Discussion started by: Nidhi2177
4 Replies

2. Shell Programming and Scripting

csv file to array, match field1, replace in flat file field1 to field2

Hello, i am bit stuck with making script for automatic procedure. Case: Two files. One is flat file, other is csv file. csv file has two column/fields with comma delimited data. Here is what i need (explained way) CSV file: field1 | field2 "hello","byebye" "hello2","byebye2"... (23 Replies)
Discussion started by: frankie_konin
23 Replies

3. UNIX for Advanced & Expert Users

if 4th and 5th character of sting -ge 45 then add 1 to 3rd character

I want to know how to, given a string like W87151WR71C, if the 4th and 5th character (in this case 15) are greater than 45, then to add 1 to the 3rd character (in this case 7) and assign the revised string the variable name MODSTRING. Thanks in advance. This is ultimately to grab info from... (6 Replies)
Discussion started by: glev2005
6 Replies

4. Shell Programming and Scripting

read the text file and print the content character by character..

hello all i request you to give the solution for the following problem.. I want read the text file.and print the contents character by character..like if the text file contains google means..i want to print g go goo goog googl google like this Using unix Shell scripting... without using... (1 Reply)
Discussion started by: samupnl
1 Replies

5. Shell Programming and Scripting

Remove 5th & 6th <td> from file

I have a page with a 6<td> structure. I need to strip the 5th and 6th <td></td> from the structure. The data in the 4th <td> varies, so I can't get a pattern on it. So, I tried setting up a count of the td occurrence and then remove the 5th and 6th, but I'm not making an progress. Is there an... (0 Replies)
Discussion started by: dba_frog
0 Replies

6. Shell Programming and Scripting

Remove 5th & 6th <td> from file

I have a page with a 6<td> structure. I need to strip the 5th and 6th <td></td> from the structure. The data in the 4th <td> varies, I can't get a pattern on it. So, I tried setting up a count of the td occurrence and then remove the 5th and 6th, but I'm not making any progress. Is there an easy,... (6 Replies)
Discussion started by: dba_frog
6 Replies

7. Shell Programming and Scripting

Script to search for a character in files in a Directory & remove it

Hi All, Am new to both Unix & this Forum - Need some help on a script that I am trying to write: In a Directory i have few text files which might or might not contain some text that I am trying to find. Once that text is found in any of the files, it needs to be removed from the file ... (6 Replies)
Discussion started by: rituparna_gupta
6 Replies

8. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 Replies

9. Shell Programming and Scripting

Grep the 5th and 6th position character of a word in a file

I am trying to find/grep the 5th and 6th position character (TX) of a word in a file. I tried to do grep "....TX" file The output gives me everything in the file with TX in it. I only need the output with the TX in the 5th and 6th position of the word. Any idea Example: test1 car... (5 Replies)
Discussion started by: e_mikey_2000
5 Replies

10. Shell Programming and Scripting

How to remove alphabets/special characters/space in the 5th field of a tab delimited file?

Thank you for 4 looking this post. We have a tab delimited file where we are facing problem in a lot of funny character. I have tried using awk but failed that is not working. In the 5th field ID which is supposed to be a integer only of that file, we are getting corrupted data as below. I... (12 Replies)
Discussion started by: Srithar
12 Replies
regcmp(3)						     Library Functions Manual							 regcmp(3)

NAME
regcmp, regex - Compile and execute regular expression LIBRARY
Standard C Library (libc.so, libc. a) SYNOPSIS
#include <libgen.h> char *regcmp( const char *string1, ... /*, (char *)0 */); char *regex( const char *re, const char *subject, ... ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: regcmp(), regex(): XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to the string that is to be matched or converted. Points to a compiled regular expression string. Points to the string that is to be matched against re. DESCRIPTION
The regcmp() function compiles a regular expression consisting of the concatenated arguments and returns a pointer to the compiled form. The end of arguments is indicated by a null pointer. The malloc() function is used to create space for the compiled form. It is the responsibility of the process to free unneeded space so allocated. A null pointer returned from regcmp() indicates an invalid argument. The regex() function executes a compiled pattern against the subject string. Additional arguments of type char must be passed to receive matched subexpressions back. A global character pointer, __loc1, points to the first matched character in the subject string. The regcmp() and regex() functions support the simple regular expressions which are defined in the grep(1) reference page, but the syntax and semantics are slightly different. The following are the valid symbols and their associated meanings: The left and right bracket, asterisk, period, and circumflex symbols retain their meanings as defined in the grep(1) reference page. A dollar sign matches the end of the string; matches a new line. Used within brackets, the hyphen signifies an ASCII character range. For example [a-z] is equivalent to [abcd...xyz]. The - (hyphen) can represent itself only if used as the first or last character. For example, the character class expression []-] matches the characters ] (right bracket) and - (hyphen). A regular expression followed by a + (plus sign) means one or more times. For example, [0-9]+ is equivalent to [0-9][0-9]*. Integer values enclosed in {} braces indicate the number of times the pre- ceding regular expression can be applied. The value m is the minimum number and u is a number, less than 256, which is the maximum. The syntax {m} indicates the exact number of times the regular expression can be applied. The syntax {m,} is analogous to {m,infinity}. The + (plus sign) and * (asterisk) operations are equivalent to {1,} and {0,}, respectively. The value of the enclosed regular expression is returned. The value is stored in the (n+1)th argument following the subject argument. A maximum of ten enclosed regular expressions are allowed. The regex() function makes its assignments unconditionally. Parentheses are used for grouping. An operator, such as *, +, or {}, can work on a single character or a regular expression enclosed in parentheses. For example, (a*(cb+)*)$0. Since all of the symbols defined above are special characters, they must be escaped to be used as themselves. NOTES
The regcmp() and regex() interfaces are scheduled to be withdrawn from a future version of the X/Open CAE Specification. These interfaces are obsolete; they are guaranteed to function properly only in the C/POSIX locale and so should be avoided. Use the POSIX regcomp() interface instead of regcmp() and regex(). RETURN VALUES
Upon successful completion, the regcmp() function returns a pointer to the compiled regular expression. Otherwise, a null pointer is returned and errno may be set to indicate the error. Upon successful completion, the regex() function returns a pointer to the next unmatched character in the subject string. Otherwise, a null pointer is returned. RELATED INFORMATION
Commands: grep(1) Functions: malloc(3), regcomp(3) Standards: standards(5) delim off regcmp(3)
All times are GMT -4. The time now is 06:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy