Sponsored Content
Top Forums Shell Programming and Scripting Remove text from n position to n position sed/awk Post 302481756 by rdcwayx on Sunday 19th of December 2010 07:06:47 PM
Old 12-19-2010
Code:
 echo "hello is there anyone can help me with this question" |awk '{$1=substr($1,2);$(NF-1)=$NF;$NF=""}1'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

translate text (1 position) with sed

Hello, I'm trying to translate a fixed length (the first 6 positions) that begins with a 0 to overwrite the field with an *. Any suggestion? File 1 ------- 013344 01:20 222343 19:30 233333 20:30 File 2 (result) ----------------- ****** 01:20 222343 19:30 233333 20:30 (5 Replies)
Discussion started by: peterk
5 Replies

2. Shell Programming and Scripting

how to find a position and print some string in the next and same position

I need a script for... how to find a position of column data and print some string in the next line and same position position should find based on *HEADER8* in text for ex: ord123 abs 123 987HEADER89 test234 ord124 abc 124 987HEADER88 test235 ... (1 Reply)
Discussion started by: naveenkcl
1 Replies

3. Shell Programming and Scripting

How to awk/sed/grep lines which contains a pattern at a given position

Dear friends I am new to linux and was trying to split some files userwise in our linux server. I have a data file of 156 continuous columns named ecscr final. I want the script to redirect all the lines containing a pattern of 7 digits to separate files. I was using grep to do that,... (2 Replies)
Discussion started by: anoopvraj
2 Replies

4. UNIX for Dummies Questions & Answers

find if a position is between a given start and end position

Hi, I am a newbie in unix programming so maybe this is a simple question. I would like to know how can I make a script that outputs only the values that are not between any given start and end positions Example file1: 2 30 40 80 82 100 file2: ID1 1 ID2 35 ID3 80 ID4 81 ID6... (9 Replies)
Discussion started by: fadista
9 Replies

5. Shell Programming and Scripting

AWK or SED to add string at specific position

Greetings. I don't have experience programing scripts. I need to insert a string in a specific position of another string on another file (last.cfg), for example: File last.cfg before using script: login_interval=1800 lcs.machinename=client04 File last.cfg after using script:... (4 Replies)
Discussion started by: vanesuke
4 Replies

6. Shell Programming and Scripting

Delete character in determinate position with sed/awk

Hello. I'm trying to delete one character in determinate position. Example: qwEtsdf123Ecv34 <delete character in positión 3> Result: qwtsdf123Ecv34 Plase, help me. Thanks (4 Replies)
Discussion started by: maria_florencia
4 Replies

7. Shell Programming and Scripting

Need command or script to print all lines from 2nd position to last but one position

hi guys, i want command or script to display the content of file from 2nd position to last but one position of a file abcdefghdasdasdsd 123,345,678,345,323 434,656,656,656,656 678,878,878,989,545 4565656667,65656 i want to display the same above file without first and... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

8. Shell Programming and Scripting

Search for a string at a particular position and replace with blank based on position

Hi, I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies

9. Shell Programming and Scripting

Inserting value at a particular position without changing the position of other characters

Hi All, I wanted a sed/awk command to add a value/character on a particular position without disturbing the position of other characters. I have file a.txt OL 10031 Day Black Midi Good Value P01 P07 OL 10031 Day Black Short Good Value P01 P07 I want to get the output as... (2 Replies)
Discussion started by: rahulsk
2 Replies

10. Shell Programming and Scripting

awk sed to repeat every character on same position from the upper line replacing whitespace

Hello is it possible with awk or sed to replace any white space with the previous line characters in the same position? I am asking this because the file I have doesn't always follow a pattern. For example the file I have is the result of a command to obtain windows ACLs: icacls C:\ /t... (5 Replies)
Discussion started by: nakaedu
5 Replies
XmTextFindString(library call)											    XmTextFindString(library call)

NAME
XmTextFindString -- A Text function that finds the beginning position of a text string SYNOPSIS
#include <Xm/Xm.h> Boolean XmTextFindString( Widget widget, XmTextPosition start, char *string, XmTextDirection direction, XmTextPosition *position); DESCRIPTION
XmTextFindString locates the beginning position of a specified text string. This routine searches forward or backward for the first occur- rence of the string starting from the given start position. If it finds a match, the function returns the position of the first character of the string in position. If the match string begins at the current position, this routine returns the current position. widget Specifies the Text widget ID. start Specifies the character position from which the search proceeds. This is an integer number of characters from the beginning of the text buffer. The first character position is 0 (zero). string Specifies the search string. direction Indicates the search direction. It is relative to the primary direction of the text. The possible values are XmTEXT_FORWARD The search proceeds toward the end of the text buffer. XmTEXT_BACKWARD The search proceeds toward the beginning of the text buffer. position Specifies the pointer in which the first character position of the string match is returned. This is an integer number of charac- ters from the beginning of the buffer. The first character position is 0 (zero). If the function returns False, this value is undefined. For a complete definition of Text and its associated resources, see XmText(3). RETURN
Returns True if a string match is found; otherwise, returns False. RELATED
XmText(3) and XmTextFindStringWcs(3). XmTextFindString(library call)
All times are GMT -4. The time now is 07:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy