need to remove '\n\t' from file and keep rest

Posted on 2005-04-13
Last Modified: 2013-12-27
i am working on a txt file. I need to remove '\n\t' (newline+tab) that is appearing in some of the lines. Tried awk and sed but cant seem to get those utilities to work. If i do an:
od -c <filename> i can see the '\n \t' characters.
i do have other newline chars '\n' that i want to keep. only wnat to get rid of back to back chars like i said above  
Question by:pdadddino

    Author Comment

    sed 's/\\n\\t//g' inputfile> outputfile

    does not do anything
    LVL 48

    Accepted Solution

    It's impossible to have a \n\t combination on the same line.  What you will be seeing is a \t\n, but don't forget that od -c will wrap lines, so if you have a line with just a \t\n, the sequence you see with od -c will be \n\t\n, where the first \n is from the previous line.

    Are you wanting to get rid of the lines with no text, eg: \t\n?

    If so, do

    sed '/[TAB]/D' file

    where [TAB] is Ctrl-V Tab


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
    FreeBSD on EC2 FreeBSD ( is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Video by: Phil
    This video goes over how to configure and start a jail in FreeBSD.  This video is meant to supplement the article included with this course.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now