The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
deleting a line but keeping the same file laiko UNIX for Dummies Questions & Answers 2 05-13-2008 02:08 PM
Deleting lines above a certain line eltinator Shell Programming and Scripting 3 10-11-2007 02:29 PM
Deleting First Two Characters On Each Line scotbuff Shell Programming and Scripting 5 12-16-2006 01:03 AM
Checking the last line and deleting srivsn Shell Programming and Scripting 3 12-13-2005 02:04 PM
Deleting UNIX End of Line Chachracter \000 uchachra UNIX for Advanced & Expert Users 3 12-22-2004 09:56 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-23-2008
pyaranoid pyaranoid is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 20
Deleting First 10 letters in a line

Hi,

Could any one of you let me know any simple Unix command for deleting first 10 letters of first line in unix?

Eg: 123456789ABC --Input

ABC--Output

Thanks

Sue
  #2 (permalink)  
Old 06-23-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Post

Quote:
Originally Posted by pyaranoid View Post
Could any one of you let me know any simple Unix command for deleting first 10 letters of first line in unix?

Eg: 123456789ABC --Input

ABC--Output
You mean CB? (1-9 is 9 chars, not 10)
Code:
echo "123456789ABC" | sed 's/^..........//'
  #3 (permalink)  
Old 06-24-2008
pyaranoid pyaranoid is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 20
Hi,

Thank you. It worked when i use the code provided by you. Suppose if i need to use that code for a file and if i want to replace the input file with the first 10 letters removed, how can i do that?

Thanks

Sue
  #4 (permalink)  
Old 06-24-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,720
Code:
sed 's/^..........//' inputfile > newfile
  #5 (permalink)  
Old 06-25-2008
pyaranoid pyaranoid is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 20
Hi,

If i do like that, i am getting an output file with 0 bytes.

Please adivice me what can be done to resolve this.

Thanks

Sue
  #6 (permalink)  
Old 06-27-2008
pyaranoid pyaranoid is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 20
Hi,

The following command gave me the correct results:

cut -c39- In_Put.txt > Out_Put.txt


Thanks Once again,

Sue

Last edited by pyaranoid; 06-27-2008 at 11:04 AM..
  #7 (permalink)  
Old 06-28-2008
tekjunky tekjunky is offline
Registered User
  
 

Join Date: Sep 2002
Posts: 9
Quote:
echo "123456789ABC" > testA && cat testA
My output is:

Quote:
123456789ABC
-----------------------------

Now run:

Quote:
cat testA |sed 's/^..........//' > testB
My output is:

Quote:
BC
in testB
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0