Sponsored Content
Top Forums UNIX for Dummies Questions & Answers awk for removing special characters and extra commas Post 302556712 by neutronscott on Monday 19th of September 2011 10:45:58 AM
Old 09-19-2011
Using "," as field separator, $1 will never have a "," in it. Possibly

Code:
awk -F"," 'length($1) && $5 != "%#" { print }' infile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing special characters in file

I have file special.txt with the following data. <header info> 123$ty5%98&0asd 1@356fgbv78 09*&^5jkns43( ...........some more rows. In my output file, I want to eliminate all the special characters in my file and I want all other data. need some help. (6 Replies)
Discussion started by: srivsn
6 Replies

2. Shell Programming and Scripting

removing special characters @ EOL

How to remove special chracters @ END OF EACH LINE in a file file1.txt: 0003073413^M 0003073351^M 0003073379^M 0003282724^M 0003323334^M 0003217159^M 0003102760^M 0002228911^M I used the below command but it is not working ? perl -pi -e 's/^M\/g' file1.txt (6 Replies)
Discussion started by: ali560045
6 Replies

3. AIX

Removing a filename which has special characters passed from a pipe with xargs

Hi, On AIX 5200-07-00 I have a find command as following to delete files from a certain location that are more than 7 days old. I am being told that I cannot use -exec option to delete files from these directories. Having said that I am more curious to know how this can be done. an sample... (3 Replies)
Discussion started by: jerardfjay
3 Replies

4. Solaris

removing special characters, white spaces from a field in a file

what my code is doing, it is executing a sql file and the resullset of the query is getting stored in the text file in a fixed format. for that fixed format i have used the following code:: Code: awk -F":"... (2 Replies)
Discussion started by: priyanka3006
2 Replies

5. Shell Programming and Scripting

Removing special characters

Dear Friends, I want to remove text between two patters. Problem is, it has random special characters like \ / | * ` ~ ! $ etc. These random special characters has no fixed length. But these special characters are appearing between a fixed pattern e.g. DM&^%#|#!\/?CT Expected output... (14 Replies)
Discussion started by: anushree.a
14 Replies

6. UNIX for Dummies Questions & Answers

Help with Removing extra characters in Filename

Hi, It's my first time here... anyways, I have a simple problem with these filenames. This is probably too easy for you guys: ABC_20101.2A.2010_01 ABD_20103.2E.2010_04 ABE_20107.2R.2010_08 Expected Output: ABC_20101 ABD_20103 ABE_20107 The only pattern available are the ff: 1) All... (9 Replies)
Discussion started by: Joule
9 Replies

7. UNIX for Dummies Questions & Answers

Removing extra new line characters

Hello, I have a text file that looks like: ABC123|some text|some more text|00001 00002 0003 0004 000019|000003|Item I have searched and found an example to remove the extra new line characters using grep and sed, but it (I think) assumes the lines start with a number and the... (5 Replies)
Discussion started by: c56444
5 Replies

8. Shell Programming and Scripting

Removing special characters - Control M

I have developed a small script to remove the Control M characters that get embedded when we move any file from Windows to Unix. For some reason, its not working in all scenarios. Some times I still see the ^M not being removed. Is there anything missing in the script: cd ${inputDir}... (7 Replies)
Discussion started by: vskr72
7 Replies

9. Shell Programming and Scripting

Removing blank/white spaces and special characters

Hello All , 1. I am trying to do a task where I need to remove Blank spaces from my file , I am usingawk '{$1=$1}{print}' file>file1Input :- ;05/12/1990 ;31/03/2014 ; Output:- ;05/12/1990 ;31/03/2014 ;This command is not removing all spaces from... (6 Replies)
Discussion started by: himanshu sood
6 Replies

10. Shell Programming and Scripting

awk - Removing extra character when setting variable

I have a data file d0 that looks like this: $cat d0 server1 running -n-cv- 8G 3.1% 1435d 15h server2 running -n---- 8G 39% 660d 22h server3 running -n--v- 8G 2.5% 1173d 6h server4 running -n---- 8G 1.1% 1048d 20h... (2 Replies)
Discussion started by: jake0391S
2 Replies
DB(1)							    BSD General Commands Manual 						     DB(1)

NAME
db -- manipulate db(3)'s btree(3) and hash(3) databases SYNOPSIS
db [-DKiNqV] [-E endian] [-f infile] [-O outsep] [-S visitem] [-T visspec] [-U unvisitem] [-X extravis] type dbfile [key [...]] db -d [-iNq] [-E endian] [-f infile] [-T visspec] [-U unvisitem] type dbfile [key [...]] db -w [-CDiNqR] [-E endian] [-F insep] [-f infile] [-m mode] [-P pagesize] [-T visspec] [-U unvisitem] type dbfile [key value [...]] DESCRIPTION
db allows manipulation of btree(3) and hash(3) (db(3)) databases. db has three modes of operation to perform upon dbfile: read Displays the given keys, and keys described in infile. If no keys and no infile is specified, the entire database is dis- played. This is the default mode of operation. delete Enabled with -d. Deletes the given keys, and keys described in infile. write Enabled with -w. Writes the given keys and values, and keys and values described in infile (in the latter case, entries are separated by insep). There are two mandatory arguments: type is the database type; either 'btree' or 'hash', and dbfile is the database file to manipulate. Options valid for all modes are: -E endian Set the endianness of the database. endian may be one of: B Big endian H Host endian L Little endian Defaults to 'H' (host endian). -f infile Contains a list of keys (for read and delete), or insep separated keys and values (for write) to be used as arguments to the given mode. If infile is '-', stdin is used. -i Keys are converted to lower case before manipulation. -N Do not include the NUL byte at the end of the key or value. -q Quiet operation. In read mode, missing keys are not considered to be an error. In delete (-d) and write (-w) modes, the result of various operations is suppressed. -T visspec Control how the items specified by the -S option are encoded and -U option are decoded. The visspec option-argument is a string specifying strsvisx(3) flags. The string consists of one or more characters: b VIS_NOSLASH c VIS_CSTYLE. Overrides h and o. h VIS_HTTPSTYLE. Overrides c and o. o VIS_OCTAL. Overrides c and h. s VIS_SAFE t VIS_TAB w VIS_WHITE -U only supports -T h. See vis(1)'s corresponding options for the meaning of these characters, and strsvisx(3) for more detail on the flags. -U unvisitem Specify items to strunvisx(3) decode. The unvisitem option-argument is a character specifying if the key (k), the value (v) or both (b) should be decoded. Read mode specific options are: -D Display duplicate entries in btree databases. -K Display key. -O outsep Field separator string between key and value. Defaults to a single tab (' '). -S visitem Specify items to strsvisx(3) encode. The visitem option-argument is a character specifying if the key (k), the value (v) or both (b) should be encoded. -V Display value. -X extravis When encoding items with -S option also encode characters in extravis, per strsvisx(3). (If neither of -K or -V is given, both options are enabled.) Write mode specific options are: -C Create new database, and truncate existing databases. -D Allow duplicate entries in btree databases. (Requires -R to be useful.) -F insep Input field separator string between key and value used when parsing infile. Defaults to a single space (' '). -m mode Octal mode of created database. Defaults to '0644'. -P pagesize Set the page size of the table to pagesize bytes. If set to '0', a database-specific default is determined, based on the block-size of the underlying file-system. Defaults to '4096'. -R Overwrite existing entries. If not specified, writing to an existing entry raises an error. SEE ALSO
vis(1), btree(3), db(3), hash(3), strsvisx(3), strunvisx(3) HISTORY
The db command appeared in NetBSD 2.0. AUTHORS
Luke Mewburn <lukem@NetBSD.org>. BSD
January 28, 2009 BSD
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy