Sponsored Content
Homework and Emergencies Homework & Coursework Questions Issue with tr, removing [:alnum:] Post 302510299 by alindner on Saturday 2nd of April 2011 10:44:15 PM
Old 04-02-2011
Issue with tr, removing [:alnum:]

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
Code:
1. The problem statement, all variables and given/known data:
 
  1. You should also know how to find files based on their characteristics.
    1. Use stat to list the meta data for the file with inode number 2793324. Your command should suppress error messages. Hint: command substitution will make this easier!
    alindner@cs215:~$ find / -inum 2793324 -exec stat {} \; 2> /dev/null File: `/usr/lib/locale/bn_IN/LC_NAME' Size: 130 Blocks: 8 IO Block: 4096 regular file Device: 801h/2049d Inode: 2793324 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2011-04-02 19:37:31.000000000 -0400 Modify: 2010-10-28 17:51:33.000000000 -0400 Change: 2011-01-16 18:08:54.000000000 -0500
    1. How many bytes would be in this file if all the alphas (a-z and A-Z) and all the numerics (0-9) where removed from it?
2. Relevant commands, code, scripts, algorithms: See 1 & 2 3. The attempts at a solution (include all code and scripts): So i am trying to remove the Alpha and Numeric characters, so i am using tr to do this, but it keep dumping characters on my screen? when i try to do this. Is this because when i less it it tells me its a binary file? tr -d "[:alnum:]" < LC_NAME4 Also wasnt sure if it was an issue with permissions as well so i made copies of the file to work on and changed permissions (chmod 7777 LC_NAME4) less LC_NAME4 ^]^Q^C ^G^@^@^@$^@^@^@/^@^@^@0^@^@^@=^@^@^@S^@^@^@f^@^@^@|^@^@^@%p%t%f%t%g^@^@শ�<8D>র�<80>^@শ�<8D>র�<80>মত�<80>^@�<95>�<81>মার�<80>^@শ�<8D>র�<80>মত�<80>^@UTF-8^@ LC_NAME4 lines 1-1/1 (END) Is there something im doing worn with tr? 4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course): KeeneState, KSC, Keene, NH, USA, Charlie W., CS215-01 Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it). ---------- Post updated at 10:44 PM ---------- Previous update was at 09:04 PM ---------- Looking tr it looks more like it for replacing? So would i be able use sed with the d option?

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removing files

I have AIX 5.1 I was wondering how to remove a file name with a space in it Say {tb lsv.csv} ? When I use the {rm} command if you have a space it thinks it is a new file. So it looks for {tb} and {lsv.csv} instead of the name as a whole. Thanks in advance Dave By the way guys and gals the... (5 Replies)
Discussion started by: rocker40
5 Replies

2. Shell Programming and Scripting

Unix Arithmatic operation issue , datatype issue

Hi, I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ). Eg: 0000001 0000220 0001235 0000022 0000023 ........... ......... ........ Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies

3. UNIX for Advanced & Expert Users

Issue with Removing Carriage Return (^M) in delimited file

Hi - I tried to remove ^M in a delimited file using "tr -d "\r" and "sed 's/^M//g'", but it does not work quite well. While the ^M is removed, the format of the record is still cut in half, like a,b, c c,d,e The delimited file is generated using sh script by outputing a SQL query result to... (7 Replies)
Discussion started by: sirahc
7 Replies

4. Shell Programming and Scripting

Vi - removing last word

Hi All, I want to remove last word from a line using Vi. Do we have any vi command for that. line : ss dd ff gg i have to run some vi command which can delete gg from the line Thanks, Ravi Sadani (4 Replies)
Discussion started by: ravi.sadani19
4 Replies

5. UNIX for Dummies Questions & Answers

ISSUE and ISSUE.NET files

In LINUX(CentOS, RedHat) is there a way to have the banner statement appear before the logon instead of after the logon? In UNIX and Windows the banner appears before a person actually logs on, what I'm seeing in LINUX is that it appears after the login(ftp, telnet, SSH). Thanks (0 Replies)
Discussion started by: ejjones
0 Replies

6. Shell Programming and Scripting

Removing whitespace issue

Hi, I have a file with rows like below delimited with pipe (|) I want to remove all the leading and trailing white space from each and every fields keeping the delimiter intact. I have tired this sed 's/*//g;s/*$//g' but the result is incorrect it is removing a whitespace from... (6 Replies)
Discussion started by: COD4
6 Replies

7. Shell Programming and Scripting

Need assistance with a file issue and a terminal issue

Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies

8. Shell Programming and Scripting

Removing Numbers

Hi, Below is a scattered representation of numbers . 1 2 11 22 11 22 1 2 1 2 11 22 1 2 11 22 I need to display only the following sequence "" and delete of the remainder from the output. The output should look like (2 Replies)
Discussion started by: Ananth12
2 Replies

9. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

10. UNIX for Dummies Questions & Answers

Removing PATTERN from txt without removing lines and general text formatting

Hi Everybody! First post! Totally noobie. I'm using the terminal to read a poorly formatted book. The text file contains, in the middle of paragraphs, hyphenation to split words that are supposed to be on multiple pages. It looks ve -- ry much like this. I was hoping to use grep -v " -- "... (5 Replies)
Discussion started by: AxeHandle
5 Replies
OD(1)									FSF								     OD(1)

NAME
od - dump files in octal and other formats SYNOPSIS
od [OPTION]... [FILE]... od --traditional [FILE] [[+]OFFSET [[+]LABEL]] DESCRIPTION
Write an unambiguous representation, octal bytes by default, of FILE to standard output. With more than one FILE argument, concatenate them in the listed order to form the input. With no FILE, or when FILE is -, read standard input. All arguments to long options are mandatory for short options. -A, --address-radix=RADIX decide how file offsets are printed -j, --skip-bytes=BYTES skip BYTES input bytes first -N, --read-bytes=BYTES limit dump to BYTES input bytes -s, --strings[=BYTES] output strings of at least BYTES graphic chars -t, --format=TYPE select output format or formats -v, --output-duplicates do not use * to mark line suppression -w, --width[=BYTES] output BYTES bytes per output line --traditional accept arguments in traditional form --help display this help and exit --version output version information and exit Traditional format specifications may be intermixed; they accumulate: -a same as -t a, select named characters -b same as -t oC, select octal bytes -c same as -t c, select ASCII characters or backslash escapes -d same as -t u2, select unsigned decimal shorts -f same as -t fF, select floats -h same as -t x2, select hexadecimal shorts -i same as -t d2, select decimal shorts -l same as -t d4, select decimal longs -o same as -t o2, select octal shorts -x same as -t x2, select hexadecimal shorts For older syntax (second call format), OFFSET means -j OFFSET. LABEL is the pseudo-address at first byte printed, incremented when dump is progressing. For OFFSET and LABEL, a 0x or 0X prefix indicates hexadecimal, suffixes may be . for octal and b for multiply by 512. TYPE is made up of one or more of these specifications: a named character c ASCII character or backslash escape d[SIZE] signed decimal, SIZE bytes per integer f[SIZE] floating point, SIZE bytes per integer o[SIZE] octal, SIZE bytes per integer u[SIZE] unsigned decimal, SIZE bytes per integer x[SIZE] hexadecimal, SIZE bytes per integer SIZE is a number. For TYPE in doux, SIZE may also be C for sizeof(char), S for sizeof(short), I for sizeof(int) or L for sizeof(long). If TYPE is f, SIZE may also be F for sizeof(float), D for sizeof(double) or L for sizeof(long double). RADIX is d for decimal, o for octal, x for hexadecimal or n for none. BYTES is hexadecimal with 0x or 0X prefix, it is multiplied by 512 with b suffix, by 1024 with k and by 1048576 with m. Adding a z suffix to any type adds a display of printable characters to the end of each line of output. --string without a number implies 3. --width without a number implies 32. By default, od uses -A o -t d2 -w 16. AUTHOR
Written by Jim Meyering. REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>. COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
The full documentation for od is maintained as a Texinfo manual. If the info and od programs are properly installed at your site, the com- mand info od should give you access to the complete manual. od (coreutils) 4.5.3 February 2003 OD(1)
All times are GMT -4. The time now is 01:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy