Sponsored Content
Top Forums Shell Programming and Scripting removing items with repeated first 3 character Post 302251916 by amir07 on Tuesday 28th of October 2008 11:01:35 AM
Old 10-28-2008
Thanks, but I am getting error:

$ ./remove_device_type.mas
awk: syntax error near line 3
awk: illegal statement near line 3
awk: syntax error near line 6
awk: bailing out near line 6
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

matching repeated character

looking for a bit of help with sed. I have a file that looks a bit like this: sdfghhjk asdfdfghgj asdfhgghj werdfvtfh edftbgh 1211211221 sdffgfm dfghnhjm dfvfsgbgh adsfv bdhgn 1111111dffg dfv1122 dsgvbghn111111 fffffffgbdghn fffffff sfgh3333gs vdf (5 Replies)
Discussion started by: robsonde
5 Replies

2. Shell Programming and Scripting

removing items from a file with batch

Please assist with awk scirpts: I need to remove items from a file in a batch: The file that I will remove from has the following format: abc00tef:10.81.12.3 abc01tef:10.81.12.3 abc02tef:10.81.12.3 abc03tef:10.81.12.3 abc04tef:10.81.12.3 abc05tef:10.81.12.3 I have a file which... (5 Replies)
Discussion started by: amir07
5 Replies

3. Shell Programming and Scripting

awk between items including items

OS=HP-UX ksh The following works, except I want to include the <start> and <end> in the output. awk -F '<start>' 'BEGIN{RS="<end>"; OFS="\n"; ORS=""} {print $2} somefile.log' The following work in bash but not in ksh sed -n '/^<start>/,/^<end>/{/LABEL$/!p}' somefile.log (4 Replies)
Discussion started by: Ikon
4 Replies

4. Programming

Removing Items In A ListView

Hi everyone! So I have a listView on my Form named "officeView" I already have the code to add and update info into it, but Im having troubles deleting items out of it. :/ Now I know how to delete an Item from the listView, but I want the item before the deleted item to become automatically... (0 Replies)
Discussion started by: romeo5577
0 Replies

5. Shell Programming and Scripting

Need some help removing a character from name

I have a file like this: DDD_ABCDE2AB2_1104081408.104480 I need to remove the 1 after the . in the file name so that it reads: DDD_ABCDE2AB2_1104081408.04480 Having some difficulty getting the command to work. I tried using cut -d 26 but that just doesn't work. (3 Replies)
Discussion started by: bbbngowc
3 Replies

6. UNIX for Dummies Questions & Answers

Removing a character

I need to remove square brackets from output of script. Output is: and I need to remove the square brackets so I am lett with 121 Is sed the only means to do this and if so what are the options? ...ok so far I have managed to get rid of ] by using /usr/bin/sed 's/]//' but that... (5 Replies)
Discussion started by: rob171171
5 Replies

7. UNIX for Dummies Questions & Answers

Need help removing last character of every line if certain character

I need help removing the last character of every line if it is a certain character. For example I need to get rid of a % character if it is in the last position. Input: aaa% %bbb ccc d%dd% Output should be: aaa %bbb ccc d%dd I tried this but it gets rid of all of the % characters.... (5 Replies)
Discussion started by: raptor25
5 Replies

8. Shell Programming and Scripting

Find repeated word and take sum of the second field to it ,for all the repeated words in awk

Hi below is the input file, i need to find repeated words and sum up the values of it which is second field from the repeated work.Im trying but getting no where close to it.Kindly give me a hint on how to go about it Input fruits,apple,20,fruits,mango,20,veg,carrot,12,veg,raddish,30... (11 Replies)
Discussion started by: 100bees
11 Replies

9. Shell Programming and Scripting

Removing duplicate items from an array

Hello Experts, I am trying to write a shell script to find duplicate items in an array, this is what i have tried : #!/bin/bash echo "This is another sample Progg to remove duplicate items from an array" echo "How many number do you want to insert" read n for (( i=0; i<$n; i++ )) do ... (5 Replies)
Discussion started by: mukulverma2408
5 Replies
rm(1)							      General Commands Manual							     rm(1)

NAME
rm - remove files or directories SYNOPSIS
file ... DESCRIPTION
The command removes the entries for one or more files from a directory. If an entry was the last link to the file, the file is destroyed. Removal of a file requires write and search (execute) permission in its directory, but no permissions on the file itself. However, if the sticky bit is set on the directory containing the file, only the owner of the file, the owner of the directory, or a user having appropri- ate privileges can remove the file. If a user does not have write permission for a file to be removed and standard input is a terminal, a prompt containing the file name and its permissions is printed requesting that the removal of the file be confirmed (see Access Control Lists below). A line is then read from standard input. If that line begins with the file is deleted; otherwise, the file remains. No questions are asked when the option is given or if standard input is not a terminal. If file is of type directory, and the option is not specified, and either the permissions of file do not permit writing and standard input is a terminal or the option is specified, writes a prompt to standard error and reads a line from standard input. If the response does not begin with it does nothing more with the current file and goes on to any remaining files. If file is a symbolic link, then only the symbolic link is removed. The file or directory pointed to by the symbolic link is not affected. If any of the intermediate path components of file happens to be a symbolic link, then follows the symbolic link and removes the file. Options recognizes the following options: Force each file or directory to be removed without prompting for confirmation, regardless of the permissions of the entry. This option also suppresses diagnostic mes- sages regarding nonexistent operands. This option does not suppress any diagnostic messages other than those regarding nonexistent operands. To suppress all error message and interactive prompts, the option should be used while redirecting standard error output to This option ignores any previous occurrence of the option. Write a prompt to standard error requesting confirmation before removing each entry. This option ignores any previous occurrence of the option. For each argument that is a directory, this option causes to recursively delete the entire contents of that directory before removing the directory itself. When used in conjunction with the option, asks whether to examine each directory before interactively removing files in that directory and again afterward to confirm removing the directory itself. The option will descend to arbitrary depths in a file hierarchy and will not fail due to path length limitations unless the length of file name, specified by the user exceeds system limitations. Equivalent to Access Control Lists If a file has optional ACL entries, displays a plus sign after the file's permissions. The permissions shown summarize the file's value returned by (see stat(2)). See also acl(5). EXTERNAL INFLUENCES
Environment Variables provides a default value for the internationalization variables that are unset or null. If is unset or null, the default value of "C" (see lang(5)) is used. If any of the internationalization variables contains an invalid setting, will behave as if all internationalization variables are set to "C". See environ(5). If set to a non-empty string value, overrides the values of all the other internationalization variables. determines the interpretation of file names as single and/or multi-byte characters, the classification of characters as printable, and the characters matched by character class expressions in regular expressions. determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informa- tive messages written to standard output. determines the location of message catalogues for the processing of International Code Set Support Single- and multibyte character code sets are supported. DIAGNOSTICS
Generally self-explanatory. Note that the option does not suppress all diagnostic messages. It is forbidden to remove the file in order to avoid the consequences of using a command such as: If a designated file is a directory, an error comment is printed unless the or option is used. RETURN VALUE
exits with one of the following values: If the option is not specified, 0 is returned only if all the named directory entries (the arguments specified in the command) are removed. If the option is specified, then all the existing named directory entries are removed. If any of the named directory entries are non-existent, still returns a zero. An error occurred. EXAMPLES
Remove files with a prompt for verification: Remove all the files in a directory: Note that the previous command removes files only, and does not remove any directories in Remove a file in the current directory whose name starts with or or some other character that is special to the shell: etc. Remove a file in the current directory whose name starts with some strange (usually nonprinting, invisible) character or perhaps has spaces at the beginning or end of the filename, prompting for confirmation: If is not unique in the directory, enter when each of the other files is prompted. A powerful and dangerous command to remove a directory is: or which removes all files and directories from without any prompting for verification to remove the files or the directories. This command should only be used when you are absolutely certain that all the files and directories in as well as itself are to be removed. DEPENDENCIES
NFS does not display a plus sign to indicate the existence of optional access control list entries when asking for confirmation before removing a networked file. SEE ALSO
rmdir(1), unlink(2), acl(5). STANDARDS CONFORMANCE
rm(1)
All times are GMT -4. The time now is 02:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy