Sponsored Content
Top Forums Shell Programming and Scripting Find Special/Null/Control Chars and Print Line Numbers Post 302844977 by Kevin Tivoli on Tuesday 20th of August 2013 12:42:52 PM
Old 08-20-2013
Find Special/Null/Control Chars and Print Line Numbers

Hi All,

This might be a basic question... I need to write a script to find all/any Speacial/Null/Control Chars and Print Line Numbers from an input file.

Output something like

Null Characters in File Name at : Line Numbers
Line = Print the line
Control Characters in File Name at : Line Numbers
Line = Print the line

Please help.

-K
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to print out line numbers of a text file?

i have this text file name test.txt which contain : aaaaa bbb iiiiiiiiiiiii ccf ddaaa ddd and i need a script that can print out the line numbers using a while loop.. so when the script is run..it will have this: 1 2 3 any ideas? :) thanks guys (4 Replies)
Discussion started by: forevercalz
4 Replies

2. Shell Programming and Scripting

Help required in displaying lines exceeding 79 chars along with their line numbers ??

Hi folks, I am looking for a solution to display those lines in any file that contains 80 or more characters along with their corresponding line number in the file. The below script will print the lines with their corresponding line numbers... sed = Sample.cpp | sed 'N;s/\n/\t/;... (8 Replies)
Discussion started by: frozensmilz
8 Replies

3. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

4. Shell Programming and Scripting

Unix help to find blank lines in a file and print numbers on that line

Hi, I would like to know how to solve one of my problems using expert unix commands. I have a file with occasional blank lines; for example; dertu frthu fghtu frtty frtgy frgtui frgtu ghrye frhutp frjuf I need to edit the file so that the file looks like this; (10 Replies)
Discussion started by: Lucky Ali
10 Replies

5. Shell Programming and Scripting

To Generate control chars[^M, ^C etc]

Hi Experts, Please let me know, how to generate control characters in a file. I want to test my script which will check for any control characters in a file before loading the data into the PRD Database. Thanks in Advance, Sapy. (2 Replies)
Discussion started by: saps19
2 Replies

6. Shell Programming and Scripting

print all between patterns with special chars

Hi, I'm having trouble with awk print all characters between 2 patterns. I tried more then one solution found on this forum but with no success. Probably my mistakes are due to the special characters "" and "]"in the search patterns. Well, have a log file like this: logfile.txt ... (3 Replies)
Discussion started by: ginolatino
3 Replies

7. Shell Programming and Scripting

Find common numbers and print yes or no

Hi I have 2 files with following data First file, sp|Q676U5|A16L1_HUMAN, Autophagy-related protein 16-1 OS=Homo sapiens GN=ATG16L1 PE=1 SV=2, Maximum coiled-coil residue probability: 0.657 in position 163. Maximum dimeric residue probability: 0.288 in position 163. ... (1 Reply)
Discussion started by: manigrover
1 Replies

8. UNIX for Dummies Questions & Answers

Grep with special chars line by line

I have a file that includes strings with special characters, eg file1 line: 1 - special 1 line: = 4 line; -3 etc How can I grep the lines of file1 from file2, line by line? I used fgrep and egrep to grep a particular line and worked fine, but when I used: cat file1|while read line;do... (2 Replies)
Discussion started by: FelipeAd
2 Replies

9. Shell Programming and Scripting

Delete Numbers, Spaces, Special Character from the begining of the line of a file

Hi All, I want to keep the name of the songs with their respective extensions only. Sample Code ======== 03 Choti choti gaiya choti choti gaval.mp3 03---Brazil Dhol.mp3 03 PAYALIYA .mp3 04 - Isq Risk .mp3 04%20-%20Oh%20My%20Love(wapking.in).mp3 08 - A2 - Aasan Nahin Yahan .mp3 AE... (3 Replies)
Discussion started by: Pramod_009
3 Replies

10. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies
erl_parse(3erl) 					     Erlang Module Definition						   erl_parse(3erl)

NAME
erl_parse - The Erlang Parser DESCRIPTION
This module is the basic Erlang parser which converts tokens into the abstract form of either forms (i.e., top-level constructs), expres- sions, or terms. The Abstract Format is described in the ERTS User's Guide. Note that a token list must end with the dot token in order to be acceptable to the parse functions (see erl_scan(3erl) ). EXPORTS
parse_form(Tokens) -> {ok, AbsForm} | {error, ErrorInfo} Types Tokens = [Token] Token = {Tag,Line} | {Tag,Line,term()} Tag = atom() AbsForm = term() ErrorInfo = see section Error Information below. This function parses Tokens as if it were a form. It returns: {ok, AbsForm} : The parsing was successful. AbsForm is the abstract form of the parsed form. {error, ErrorInfo} : An error occurred. parse_exprs(Tokens) -> {ok, Expr_list} | {error, ErrorInfo} Types Tokens = [Token] Token = {Tag,Line} | {Tag,Line,term()} Tag = atom() Expr_list = [AbsExpr] AbsExpr = term() ErrorInfo = see section Error Information below. This function parses Tokens as if it were a list of expressions. It returns: {ok, Expr_list} : The parsing was successful. Expr_list is a list of the abstract forms of the parsed expressions. {error, ErrorInfo} : An error occurred. parse_term(Tokens) -> {ok, Term} | {error, ErrorInfo} Types Tokens = [Token] Token = {Tag,Line} | {Tag,Line,term()} Tag = atom() Term = term() ErrorInfo = see section Error Information below. This function parses Tokens as if it were a term. It returns: {ok, Term} : The parsing was successful. Term is the Erlang term corresponding to the token list. {error, ErrorInfo} : An error occurred. format_error(ErrorDescriptor) -> Chars Types ErrorDescriptor = errordesc() Chars = [char() | Chars] Uses an ErrorDescriptor and returns a string which describes the error. This function is usually called implicitly when an ErrorInfo structure is processed (see below). tokens(AbsTerm) -> Tokens tokens(AbsTerm, MoreTokens) -> Tokens Types Tokens = MoreTokens = [Token] Token = {Tag,Line} | {Tag,Line,term()} Tag = atom() AbsTerm = term() ErrorInfo = see section Error Information below. This function generates a list of tokens representing the abstract form AbsTerm of an expression. Optionally, it appends Moretokens . normalise(AbsTerm) -> Data Types AbsTerm = Data = term() Converts the abstract form AbsTerm of a term into a conventional Erlang data structure (i.e., the term itself). This is the inverse of abstract/1 . abstract(Data) -> AbsTerm Types Data = AbsTerm = term() Converts the Erlang data structure Data into an abstract form of type AbsTerm . This is the inverse of normalise/1 . ERROR INFORMATION
The ErrorInfo mentioned above is the standard ErrorInfo structure which is returned from all IO modules. It has the format: {ErrorLine, Module, ErrorDescriptor} A string which describes the error is obtained with the following call: Module:format_error(ErrorDescriptor) SEE ALSO
io(3erl) , erl_scan(3erl) , ERTS User's Guide Ericsson AB stdlib 1.17.3 erl_parse(3erl)
All times are GMT -4. The time now is 01:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy