Delete between 10th character and 20th character


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Delete between 10th character and 20th character
# 1  
Old 12-15-2008
Delete between 10th character and 20th character

Hi,

I have a .txt and I need to delete the characters betwwen the 10th and 20th...

How can I do that...

I need to do somethink like these:

%s/I don't know how to define a range between 10th and 20th character//g

Can you help me...

If I want the 10 first characters i do this:
%s/..........^//g

Thank you very much

Regards,
Nuno Oliveira
# 2  
Old 12-15-2008
will this work for you? You may need to adjust 200 to whatever your maximum line length is.

Code:
 cut -c1-9,21-200 data.txt

# 3  
Old 12-17-2008
Quote:
Originally Posted by frank_rizzo
will this work for you? You may need to adjust 200 to whatever your maximum line length is.

Code:
 cut -c1-9,21-200 data.txt


There's no need to adjust anything; just leave out the last parameter:

Code:
cut -c1-9,21- data.txt

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies

2. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies

3. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
2 Replies

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

5. Shell Programming and Scripting

In Sed how can I replace starting from the 7th character to the 15th character.

Hi All, Was wondering how I can do the following.... I have a String as follows "ACCTRL000005022RRWDKKEEDKDD...." This string can be in a file called tail.out or in a Variable called $VAR2 Now I have another variable called $VAR1="000004785" (9 bytes long), I need the content of... (5 Replies)
Discussion started by: mohullah
5 Replies

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

7. Shell Programming and Scripting

Deleting all characters from 350th character to 450th character from the log file

Hi All, I have a big log file i want to delete all characters (between 350th to 450th characters) starting at 350th character position to 450th character position. please advice or sample code. (6 Replies)
Discussion started by: rajeshorpu
6 Replies

8. Shell Programming and Scripting

read in a file character by character - replace any unknown ASCII characters with spa

Can someone help me to write a script / command to read in a file, character by character, replace any unknown ASCII characters with space. then write out the file to a new filename/ Thanks! (1 Reply)
Discussion started by: raghav525
1 Replies

9. Shell Programming and Scripting

delete \n character

Hello. I'm next problem.. I'm a tmp file $ cat tmp word1 word2 word3 word4 and I like have word1 word2 word3 word4 I try with: $ cat tmp |sed 's/\n//' word1 word2 word3 (2 Replies)
Discussion started by: ReneVielma
2 Replies

10. UNIX for Advanced & Expert Users

How to delete a character

Hi, T think this is a question for Perderabo. If you think you know the answer you must be very good ! :) Most of us know how the make the <backspace> key backspace a character. Now how do I make the <delete> key delete a character. !! So when I press the delete key the character after... (3 Replies)
Discussion started by: davidg
3 Replies
Login or Register to Ask a Question