LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-02-2017, 03:04 PM   #16
jdoginky
LQ Newbie
 
Registered: Feb 2017
Location: Louisville Ky.
Posts: 7

Original Poster
Rep: Reputation: Disabled

The requirements are:
If char 3-5 is in the convert file
If char 3-5 and 138-140 match
convert both
else
convert char 3-5
replace char 138-140 with spaces
fi
fi
 
Old 03-03-2017, 12:31 AM   #17
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,879

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
in awk you can use the function substr to get char3-5 or similar, so looks pretty easy to check.
conversion and replacement also easy, you need to split your line into 5 pieces: before 3, 3-5, 6-137, 138-140, 141- and construct the result by concatenating required parts.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PDF to Text Conversion limnephilidae Programming 5 01-03-2012 08:22 AM
String of text conversion jeewiz Linux - General 3 09-24-2009 11:10 PM
html to text conversion munna_dude Programming 15 10-19-2007 06:45 AM
Text File conversion agallant Programming 16 05-24-2004 08:01 AM
PDF to Text Conversion limnephilidae Linux - Software 2 06-25-2003 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration