Stripping off beginning characters

I'm new with Linux and I have a very large file where I have to strip off the first 13 fields or characters. How can this be done?

if you have to do this only once/a few times, a quick way to get it done is
mv large_file large_file_bck
sed s/^.............// < large_file_bck > large_file
(mark the 13 dots...)
if this is an operation you need to do regularly, you could create a better script
a naive script will do the job:
with 2 parameters:
1st the number of chars to strip, 2nd the file name:
#!/bin/bash
# strip_lead nb file
# strip leading chars from text file
mv "${2}" "${2}".bck
a='^'
for ((i=0; i<"${1}"; i++ )) do a="${a}."
done
sed s/`echo "${a}"`// < "${2}".bck > "${2}"
strip_lead 13 somefile
will remove the first 13 chars from the text file
guido

Similar Messages

  • [APEX4.0] - Websheet apps strips off national characters

    Hi,
    In Apex 4.0, when creating page in websheet app, the national charactes in the content are stripped off (in my case polish: ąćźżśń) ...although some characters remain unchanged (eg. ó)
    Any ideas how to fix this?

    Hi,
    propably the same (or similar) problem as described here:
    4.0, web sheet data load, special characters (de, ÄÖÜ etc.) mess
    Would be nice just to get an info wheter this is an known issue to be fixed or if we are dealing with a feature that should not use by users with "uncommon" languages. -:)
    Regards
    Andre

  • JAXP seems to be stripping off DOCTYPE tag

    When I parse a document, the DOCTYPE tag is getting stripped off.
    To parse, I read the document from file and it looks like :
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j">
    After parsing, I dump it to the console and it looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <log4j:configuration debug="null" threshold="null" xmlns:log4j="http://jakarta.apache.org/log4j">
    The mystery the output has two attributes set to defaults, the only the parser knows this is by reading the dtd. But why does not include the DOCTYPE tag?
    The parsing code snippet is:
    Document doc = null;
    DocumentBuilderFactory dbFactory = null;
    dbFactory = DocumentBuilderFactory.newInstance();
    dbFactory.setNamespaceAware(true);
    DocumentBuilder db = dbFactory.newDocumentBuilder();
    db.setEntityResolver(new LogDTDResolver());
    doc = db.parse(is);  // is is an InputStreamAnyone have a clue? Is there a property I am missing. I have searched for the complete set of jaxp properties, but I can't find one.
    Thanks for any help.

    So it looks like log4j is doing its own parsing and it requires the DTD. Don't know how (or why) it does that.
    You call the setOutputProperty() method of the Transformer. This is designed to configure the Transformer with properties that are normally set in the <xsl:output> element of an XSL transformation. The properties you need are "doctype-system" and maybe "doctype-public".
    You're quite right, it isn't obvious. That's what happens when systems are designed by architects who believe in abstraction too much.

  • Stripping Off ?xml version="1.0" ? tag in the final output XML

    Hi All,
    Is there anyway that we can strip off the tag <?xml version="1.0" ?> from the Final XML generated by BPEL.
    I have commented out<?xml version="1.0" ?> in the XSL mapper file but still it is coming in the output file that is generated.
    Any help or pointer is really appreciated.
    Thanks,
    Dibya

    Hi,
    I want to strip it off because I am apppending the same in a Java Program.
    Please let me know how can it be done.
    Appreciate your inputs.
    Thanks,
    Dibya

  • Stripping off XML tags

    Hi,
    Can someone help me with providing some code on how to strip off the XML tags in an XML file like the following:
    <?xml version = '1.0'?>
    <!--<?xml-stylesheet type="text/xsl" href="XYZ.xsl"?> -->
    <ROWSET>
    <ROW num="1">
    <PRODUCT_NAME>ABC</PRODUCT_NAME_NAME>
    </ROW>
    <ROW num="2">
    All I want to get back is whatever in between <product_name>. Basically, all the tags with <..> I need to get rid off from this XML file.
    Does anybody know if I can use regular expressions in java? That way, would it be easier not to use parsers?
    Please provide me ideas, sources, examples, etc.
    Thanks in advance.

    I worked on the solution, but, it's coming up with a blank list.
    Any solution to resolve this!
    Here's the code:
    public class Test extends JFrame
         JList list;
         JScrollPane listContainer;
         public Test()
              setSize(300, 300);
              setVisible(true);
              setTitle("ProdList");
              initialize();
         // domParse();     // Getting error- how do i call this function?
         public void initialize()
              list = new JList(new DefaultListModel()); // Set the initial model
              listContainer = new JScrollPane(list);
              listContainer.setSize(new Dimension(200, 200));
              getContentPane().setLayout(new BorderLayout());
              getContentPane().add(listContainer, "Center");
              validate(); // Validate the screen
         // public void domParse(String url)
         public void domParse(String url)
              DocumentBuilder parser;
              DocumentBuilderFactory factory =
                        DocumentBuilderFactory.newInstance();
              try {
                        parser = factory.newDocumentBuilder();
                        Document doc = parser.parse(url);
              NodeList product_names = doc.getElementsByTagName("PRODUCT_NAME");
              if(product_names!=null)
              for(int i=0;i<product_names.getLength();++i)
                   // get all child nodes of a <product_name> - node
                   NodeList product_name_children=product_names.item(i).getChildNodes();
                   // and display contents of text nodes
              for(int j=0;j<product_name_children.getLength();++j)
                   Node node=product_name_children.item(j);
              //if(node.getNodeType()==Node.TEXT_NODE)
                   //System.out.println("element <"+product_names.item(i).getNodeName()+">'s text=["+node.getNodeValue()+"]");
              else
                   System.out.println("no element <PRODUCT_NAME> found");
              } catch (Exception e)
              // e.printStackTrace();
              static public void main(String[] args)
                   Test x=new Test();
                   x.domParse("Test.xml");

  • Muse strips off digimarc copyright in jpeg files saved in photoshop. How do I prevent this from happening?

    In Muse, the digimarc watermark I added in jpegs saved in photoshop get stripped off when uploaded to my website. How can I prevent this from happening? The jpegs are set to their exact size in Muse. Thanks.

    Hello
    My procedure is to resize the original psd file in photoshop, change the mode to 8bits, apply the digimarc filter and then save as jpeg. I place the file in Muse without changing its size and upload. I then right click to save the uploaded image from my website and bring it into photoshop to verify the digimarc watermark. The digimarc filter shows there is no watermark at all.

  • How do I strip off a time format off of a string array

    How do I strip off a the first part of a time format out of a string array. The following is what it looks like
    14 April 2008 10:00:00.000, 30.000,128.591,-145.839
     "       "      "     10:00:01.000, "              "              "
    I tried the read from speadsheet file first. I tried lower level VIs. There must be something simple I am just missing.

    Search for the first comma and take the data before it.
    Message Edited by Ravens Fan on 12-10-2008 04:50 PM
    Attachments:
    Example_VI_BD.png ‏2 KB

  • Strip off markups of generic XML data with E4X

    I have a generic XML file:
    <nodes>
    <node1 att1='abc' att2='xyz'>
    <ele1> Hello </ele1>
    <ele2> Hi </ele2>
    </node1>
    </nodes>
    The tag and attribute names above can be anything. I need a
    generic method to strip off the XML markups and display the
    contents as:
    node1@att1: abc
    node1@att2: xyz
    node1.ele1: Hello
    node1.ele2: Hi
    How can E4X do this?

    e4x is for manipulating/navigating your xml. But you can use
    it inside a for/each loop to look at your xml nodes and extract the
    strings without the xml tags using toString().
    Search the help docs for "XML type conversion" and see the
    toString() method in action.

  • Upload to Mobile Me strips off EXIF information?

    If I plug in the iPhone, import the pictures I've taken into my iPhoto Library, upload them to a MobileMe Web Gallery, and look at their EXIF information (using the "i" button in a slidehow), all the GPS information and other tags are on there.
    If I choose a photo on the iPhone itself and send it to mobile me, it arrives there with no GPS information and other tags are missing. Why? How in the heck can we do mobile geotagging if the system is stripping off all the GPS information?

    Go to the System/MobileMe preference pane, log out, log in with a bogus name and password (this clears the name and password cache) and log in with the correct MMe account name and password. Then try again.

  • Stripping off the glossy coating?

    I bought a new MBP with the glossy screen, and I really hate it. It's very annoying to see my own reflection in the screen all the time. I really wish I'd gone to an Apple store and actually seen the screen before I made the purchase.
    Is the glossy display just a matte display with a coating on top of it? Would it be theoretically possible to strip off this top coating and end up with a matte display? A razor? An chemical cleaner? I do not intend to do anything rashly, but ...
    Exchanging the machine would result in a re-stocking fee and replacing the display would be about $800 (according to a Genius Bar guy), and neither of these options are within my budget.

    Is the glossy display just a matte display with a coating on top of it?
    No, the coatings are different.
    Would it be theoretically possible to strip off this top coating and end up with a matte display? A razor? An chemical cleaner? I do not intend to do anything rashly, but
    Just the thought is rash!
    Ultimately, if you can't afford the restocking fee maybe you can find someone with a matte version that's prepared to make a straight swap with you. In my opinion the best two options you have are…
    1) Wear the restocking fee and just learn from the experience
    2) Just keep it and just learn from the experience

  • Stripping-off the leading zeros

    Hi Experts,
    I have a mapping requirement in which I need to map a  source field with a target field in which I need to strip off the leading say 4 zeros from the target field. Now, can this be done with standard PI functions available or we need an UDF for this functionality.
    Please let me know.
    Regards,
    Aniruddha

    Hi Aniruddha,
    You can do it with the standard function formatNumber.
    Also, you can write a custom UDF with the following code:
    String ret = a.replaceFirst("^0+","");
    return ret;
    Best regards,
    JN

  • FCP strips off closed captions

    I'm adding closed captions to a FCP sequence on line 21, but when I master to Digibeta the closed captions are stripped off. I'm using FCP 5 with AJA Kona 2 card. Any ideas?

    I'm creating the captions in MacCaption and adding them to the sequence...just as I have in my Avid Mediacomposer. When I do it with the Avid and master to Digibeta it retains the captions...when I do the same process with FCP the captions are gone. How do I close caption with FCP

  • Strip off the base64 content from an XML and saving the rest in streaming fashion using XML Reader Class.

    Hi,
    I'm presently working in a scenario, where i need to read an XML (having base64 encoded images) using XmlReader class in a streaming fashion (considering the performance) .
    1) I have to strip offs the base64 encoded contents from the xml (front & back image node).
    2) Than saving the remaining XML (without base64 content) . 
    Sample XML:-
    <?xml version="1.0" encoding="utf-8"?>
    <tran>
      <tranheader>
     <feild1></feild1>
      </tranheader>
      <item>
    <fields></fields>
        <image>
          <frontimage>base64_content</frontimage>
          <rearimage>base64_content</rearimage>
        </image>
      </item>
      <item>
        <fields></fields>
        <image>
          <frontimage>base64_content</frontimage>
          <rearimage>base64_content</rearimage>
        </image>
      </item>
      <trantrailer>
        <feild1></feild1>
      </trantrailer>
    </tran>
    Please guide.
    Thanks & Regards

    E.g. a simplified skeleton:
    namespace ConsoleCS
    using System;
    using System.IO;
    using System.Xml;
    using System.Xml.Linq;
    class Program
    static void Main(string[] args)
    XDocument xdocument = XDocument.Parse(@"
    <Items>
    <Item>Test with a child element <more/> stuff</Item>
    <Item>Test with a CDATA section <![CDATA[<456>]]> def</Item>
    <Item>Test with a char entity: &#65;</Item>
    <SkipItem>Item to skip.</SkipItem>
    <!-- Fourteen chars in this element.-->
    <Item>1234567890ABCD</Item>
    </Items>");
    StringReader stringReader = new StringReader(xdocument.ToString());
    XmlReader xmlReader = XmlReader.Create(stringReader);
    xmlReader.MoveToContent();
    while (xmlReader.Read())
    switch (xmlReader.NodeType)
    case XmlNodeType.Element:
    if (xmlReader.Name == "SkipItem")
    Console.WriteLine("Skipping..");
    else
    Console.WriteLine("Pushing to output ({0}).", xmlReader.Name);
    break;
    Console.WriteLine("Done.");
    Console.ReadLine();

  • Please Help!!   (Stripping first 7 Characters of every line in a file???

    Hey guys,
    I need to read in a file but strip the first 7 characters from each line in the file???
    How do i do it...
    Any help will be appreciated...

    Dear Friend,
    Thankyou very much for your interest.
    I am trying to strip the 1st 7 characters from the following file while reading....
    1. <?xml version="1.0" encoding="UTF-8"?>
    2.
    3. <DOCUMENT>
    4. <GREETING>
    5. THE LIVE EXAMPLE...
    6. <MESSAGE>
    7. </GREETING
    8. If this works then your project is over...;;;
    9. </MESSAGE>
    10. </DOCUMENT>
    I meant, if my file contains line break (space of a line between two lines just like in Double Line spacing. Eg. between 1 and 3).... the program doesn't read after reading the first line. Your method does stip first seven characters of first line...
    Your help is appreciated....

  • Safari "tel:" phone number links stripping non-numeric characters

    After a week of owning my iPhone (two weeks after it launched) I made myself a little web interface that contain various iPhone-helpful links. Four of these were AT&T specific telephone links:
    *646# - check how many minutes remaining
    *729 - pay your bill
    etc etc..
    (e.g. <a href="tel:*729">click here to pay your bill</a>)
    Well, needless to say this was a very convenient feature, however these links no longer function properly. It seems that the iPhone is now stripping any/all non-numeric characters from the link (although I haven't done extensive testing to see exactly which characters .. only with * and $ in particular).
    I've even tried HTML entities but they were stripped too.
    Now I know apple had a security fix a few patches back, one that fixed a vulnerability involving "tel:" links (CVE-2007-3755), but I haven't found any documentation regarding special characters now being ignored/stripped.
    So, my question is does anyone know if there is a workaround for this, or did the patch inadvertently and permanently destroy the ability to send these very helpful text messages via a web interface?
    Thanks,
    Marc

    I'm having a similarly annoying behavior with "tel:" links. I'm doing the same thing -- writing a web page to store some convenient numbers, but for me, it's for teleconference numbers. You dial into a toll-free number, then after a pause, dial in a passcode.
    On the iPhone's contact list, you can program in the pauses as the letter "p."
    However, in a tel: link, the p's change to 7's. Interesting!
    What I've discovered is that, for me (FW 1.1.2), alphabetical characters are translated into their numerical equivalents. So 1-800-COMCAST (a number I've had to dial all too much recently) gets rendered to 18002662278.
    This is a difference between Safari 3 and the iPhone version. On Safari 3 on the Mac, both the HTML and a mouseover shows that the tel link contains the letters. On the iPhone, though, clicking the link brings up a dialog box with the letters "translated."
    So, interesting -- but now I have a problem. How do I enter a pause into a tel link?

Maybe you are looking for

  • How can I stop iTunes from grabbing the CD drive?

    I want to use cdparanoia as my ripper but iTunes keeps automounting the drive when cdparanoia gets a couple of sectors in, even if I disable disk level automounting e.g. diskarbitration and friends. I conclude it must be happening at application leve

  • Roaming network without effect

    Hi guys ¨¨ I need some help. I have 2 airport extremes (A1143, one of them is 1 gen and the other is 2 gen) and have made a roaming network in my 120 m^2 appartment, but i dont really feel a difference ! in the utility on my imac i have same ssid nam

  • No increase in speed with parallel processing on quad-core

    I'm using the NI Vision vi "IMAQ correct calibrated image" on quite a large image.  This takes about 0,09 seconds to complete, and only uses 1 core of my computer.  (25% cpu time)   I always need to correct two images, so I made two parallel executio

  • Using XI for printing

    Hi All, We have one requiremnt ie Printing Billing documents by third party vendor. Large volume of information need to be printed by remote printer. Scenario SAP-ISU-XI-printer Is suggestable or not, whether it is coming under best practice even if

  • Spry Password Question

    I've been reading a lot about spam protection for contact forms and I have heard a lot of people talking about honeypots. They say just use a field that you tell people not to fill out and if it is field out when submitted ignore the message. My clie