## sed to remove last 2 characters of txt file

sed to remove last 2 characters of txt file
# 1
sed to remove last 2 characters of txt file

sed 's/^..//' file1.txt > file2.txt
this will remove the first two characters of each line of a text file, what sed command will remove the last two characters? This is a similar post to my other....sry if I'm being lazy....

I need a file like this (same as last post)
>cat file1.txt
10081551
10081599
10082234
10082259
20081134
20081159
30082232
10087721
>

to look like this:
>cat file1.txt
100815
100815
100822
100822
200811
200811
300822
100877
>
 ajp7701 View Public Profile for ajp7701 Find all posts by ajp7701
# 2
Closing it.

Test Your Knowledge in Computers #481
Difficulty: Medium
Generally speaking, programs do not start out as source code.
True or False?

## How does this sed expression to remove non-alpha characters work?

Hello! I know that this expression gets rid of non-alphanumeric characters: sed 's///g' and I understand that it is replacing them with nothing - hence the '//'-, but I don't understand how it's doing it. It seems it's finding strings that begin with alphanumeric and replacing them with...

## Sed - remove special characters

Hi, I have a file with this line, it's always in the first line: I want to remove these special characters: ´╗┐ file1 ´╗┐\\bar\c$\test2\;3.348.118 Bytes;160 ;3 \\bar\c$\test\;35 Bytes;2 ;1 I want the same file to be only \\bar\c$\test2\;3.348.118 Bytes;160 ;3 \\bar\c$\test\;35...

## Remove the Characters '[' and ']' with Sed

Hi, I am new to Sed and would like to know if it is possible to remove the characters . I have a couple of files with a keyword and would like to remove the substring. I am Using sed s/// but Its not working Thanks for your Support Andrew Borg

## Sed or trim to remove non alphanumeric and alpha characters?

Hi All, I am new to Unix and trying to run some scripting on a linux box. I am trying to remove the non alphanumeric characters and alpha characters from the following line. <measResults>883250 869.898 86432.4 809875.22 804609 60023 59715 </measResults> Desired output is: 883250...

## How to remove characters from multiple .txt files

Friends, I want to remove charecters from multiple .txt files. Foe example : In this .txt files there are many "ctrl m" present in last of each line in one .txt file. I want to remove "ctrl m" from each line from all .txt files. Need your help regarding this.

## sed command to remove characters help!

I am trying to analyse a large file of sequencing data, example of first 10 lines below, @HWUSI-EAS656_0044_FC:7:1:2447:1039#GCAATT/1 GNCTATGGCTTGCCGGGCTCAGGGAAGACAATCATAGCCATGAAAATCATGGAAAAGATCAGAAAAACATTTCAA +HWUSI-EAS656_0044_FC:7:1:2447:1039#GCAATT/1...

## grep or sed. How to remove certain characters

Here is my problem. I have a list of phone numbers that I want to use only the last 4 digits as PINs for something I am working on. I have all the numbers in a file but now I want to be removed all items EXCEPT the last 4 digits. I have seen sed commands and some grep commands but I am...

## sed: remove characters between and including 2 strings

I have the following line: 4/23/2010 0:00:38.000: Copying 3MSYDDC02$I would like to use sed (or similiar) to remove everthing between and including$ that appears in the line so it ends up like this. 4/23/2010 0:00:38.000: Copying 3MSYDDC02I have been trying these but i'm really just...

## sed to remove 1st two characters every line of text file

what is the sed command to remove the first two characters of every line of a text file? each line of the text file has the same amount of characters, and they are ALL NUMERIC. there are hundreds of lines though. for example, >cat file1.txt 10081551 10081599 10082234 10082259 20081134...

## Reading Characters from txt file

Hello, I am new to shell scripting, and I am trying to create a script that reads an input like the following firstname:lastname:age firstname:lastname:age firstname:lastname:age in a text file. I have a 2 part question. First how do I open the file in a shell script. And then how can...