The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SED help (remove line::parse again::add line) Malumake Shell Programming and Scripting 6 10-24-2007 06:02 PM
Start Input not on next line? nortypig Shell Programming and Scripting 4 08-31-2006 06:20 AM
Remove header(first line) and trailer(last line) in ANY given file madhunk Shell Programming and Scripting 2 03-13-2006 03:36 PM
how to remove line greater then 3000 characters. naren_14 UNIX for Advanced & Expert Users 10 06-16-2005 12:00 AM
awk and getting # of characters in a line smacleod UNIX for Dummies Questions & Answers 1 04-15-2002 02:57 PM

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 03-26-2008
minifish minifish is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 31
sed remove last 10 characters of a line start from 3rd line

hello experts,
I need a sed command that remove last 10 characters of a line start from 3rd line.
any suggestions?

Thanks you
  #2 (permalink)  
Old 03-26-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Last 10? or start from? Proper grammar would help here.

Remove last ten characters on all lines from the third through the end:


Code:
sed '3,$s/..........$//'

Coping with lines with fewer than ten characters left as a desperate follow-up question with incomplete sentences and weird terminology. You're welcome.
  #3 (permalink)  
Old 03-26-2008
minifish minifish is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 31
say I have a line:
blablabla
blablabla
asdfasdf0123456789
asdfasdf0123456789

I want the out put to be:
blablabla
blablabla
asdfasdf
asdfasdf

thank you
  #4 (permalink)  
Old 03-26-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
And the stuff about the third line was just to confuse the enemy? Did you try the script I posted? You can probably adapt it if it doesn't do exactly what you mean.
  #5 (permalink)  
Old 03-26-2008
minifish minifish is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 31
hehehe
sorry, I meant

a file:
blablabla
blablabla
blablabla
asdfasdf0123456789
asdfasdf0123456789

output:
blablabla
blablabla
blablabla
asdfasdf
asdfasdf
  #6 (permalink)  
Old 03-26-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
You didn't try the script, and are unable or unwilling to make a trivial modification to it?
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 01:24 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