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
DEBCONF-MERGETEMPLATE(1)					      Debconf						  DEBCONF-MERGETEMPLATE(1)

NAME
debconf-mergetemplate - merge together multiple debconf template files SYNOPSIS
debconf-mergetemplate [options] [templates.ll ...] templates DESCRIPTION
Note: This utility is deprecated. You should switch to using po-debconf's po2debconf program. This program is useful if you have multiple debconf templates files which you want to merge together into one big file. All the specified files will be read in, merged, and output to standard output. This can be especially useful if you are dealing with translated template files. In this case, you might have your main template file, plus several other files provided by the translators. These files will have translated fields in them, and maybe the translators left in the english versions of the fields they translated, for their reference. So, you want to merge together all the translated templates files with your main templates file. Any fields that are unique to the translated files need to be added in to the correct templates, but any fields they have in common should be superseded by the fields in the main file (which might be more up-to-date). This program handles that case properly, just list each of the translated templates files, and then your main templates file last. OPTIONS
--outdated Merge in even outdated translations. The default is to drop them with a warning message. --drop-old-templates If a translation has an entire template that is not in the master file (and thus is probably an old template), drop that entire template. SEE ALSO
debconf-getlang(1) AUTHOR
Joey Hess <joeyh@debian.org> 2012-09-10 DEBCONF-MERGETEMPLATE(1)
All times are GMT -4. The time now is 09:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy