Delete Last Char from first World


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Delete Last Char from first World
# 1  
Old 07-23-2012
Bug Delete Last Char from first World

HI

File A.txt

Code:
Abcde12351 Kalel
Abcde12962 Basil
Abcde21653 Fosil

Output B.txt

Code:
Abcde1235 Abcde12351 Kalel
Abcde1296 Acbde12962 Basil
Abcde2165 Acbde21653 Fosil

Thanks
# 2  
Old 07-23-2012
Try this:
Code:
awk '{len=length($1); $1=substr($1,1,len-1); print $0   }' inputfile > outputfile

This User Gave Thanks to jim mcnamara For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

Mad World Remix of Moby Video (Are You Lost In The World Like Me)

This is an excellent video comment on modern society and the remix is good too: https://www.youtube.com/watch?v=5DU1B_XkyIk 5DU1B_XkyIk Watch the video above and post your comments. (3 Replies)
Discussion started by: Neo
3 Replies

2. Shell Programming and Scripting

Delete Word between two Char.

HI Guys, I have Input:- A nput A.txt 000100/port_xcu_dev_6/port_0_dev_7 000100/port_xcu_dev_6/port_1_dev_10 000100/port_xcu_dev_2/port_2_dev_8 000100/port_xcu_dev_3/port_3_dev_11 000100/port_xcuv_9/port_4_dev_9 ... (3 Replies)
Discussion started by: pareshkp
3 Replies

3. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially): xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’: xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’ The same error with all c++ constructors - gcc 4.4.4. If anyone can throw any light on... (8 Replies)
Discussion started by: GSO
8 Replies

4. UNIX for Dummies Questions & Answers

delete first two " char

Hi, I need to delete the char " from a line but only the first 2 example: JPY,0,XS0122118481,CCDO,IFI_CCDO,"2,210,000,000","2,210,000,000",0.00 result: JPY,0,XS0122118481,CCDO,IFI_CCDO,2,210,000,000,"2,210,000,000",0.00 How may I go about doing this? Thanks (2 Replies)
Discussion started by: UNovIX
2 Replies

5. Programming

concat const char * with char *

hello everybody! i have aproblem! i dont know how to concatenate const char* with char const char *buffer; char *b; sprintf(b,"result.txt"); strcat(buffer,b); thanx in advance (4 Replies)
Discussion started by: nicos
4 Replies

6. Programming

Adding a single char to a char pointer.

Hello, I'm trying to write a method which will return the extension of a file given the file's name, e.g. test.txt should return txt. I'm using C so am limited to char pointers and arrays. Here is the code as I have it: char* getext(char *file) { char *extension; int i, j;... (5 Replies)
Discussion started by: pallak7
5 Replies

7. Shell Programming and Scripting

sed - delete until char x

Hi, I got a Textfile contains hundreds of lines like this: 3 02 8293820 0 22 22 All I need is this: 293820 0 22 22 So i decided to delete until the first '8' comes up. But how I can realize that? (9 Replies)
Discussion started by: mcW
9 Replies

8. Shell Programming and Scripting

How to replace any char with newline char.

Hi, How to replace any character in a file with a newline character using sed .. Ex: To replace ',' with newline Input: abcd,efgh,ijkl,mnop Output: abcd efgh ijkl mnop Thnx in advance. Regards, Sasidhar (5 Replies)
Discussion started by: mightysam
5 Replies
Login or Register to Ask a Question