Sponsored Content
Top Forums UNIX for Dummies Questions & Answers shell script to find noof characters in a file name Post 302402436 by krishnampkkm on Tuesday 9th of March 2010 11:48:27 PM
Old 03-10-2010
The actual result I need is

ls -l
total 36
-rw-r--r-- 1 krishna users 146 2010-03-10 10:11 21.sh
-rw-r--r-- 1 krishna users 147 2010-03-10 10:11 21.sh~
-rw-r--r-- 1 krishna users 505 2010-03-09 11:42 input
-rw-r--r-- 1 krishna users 34 2010-03-08 06:19 new1.sh
-rw-r--r-- 1 krishna users 2 2010-03-08 06:15 new1.sh~
-rw-r--r-- 1 krishna users 568 2010-03-10 10:11 temp
-rw-r--r-- 1 krishna users 69 2010-03-08 06:08 test1.sh
-rw-r--r-- 1 krishna users 2 2010-03-08 05:55 test1.sh~
-rw-r--r-- 1 krishna users 98 2010-03-09 11:42 today.sh
-rw-r--r-- 1 krishna users 0 2010-03-09 11:42 today.sh~



But I'm getting like

bash-3.1$ sh 1.sh
2
5
6
-rw-r--r-- 1 krishna users 505 2010-03-09 11:42 input 5
-rw-r--r-- 1 krishna users 34 2010-03-08 06:19 new1.sh 7
-rw-r--r-- 1 krishna users 2 2010-03-08 06:15 new1.sh~ 8
-rw-r--r-- 1 krishna users 0 2010-03-10 10:12 temp 4
-rw-r--r-- 1 krishna users 69 2010-03-08 06:08 test1.sh 8
-rw-r--r-- 1 krishna users 2 2010-03-08 05:55 test1.sh~ 9
-rw-r--r-- 1 krishna users 98 2010-03-09 11:42 today.sh 8
-rw-r--r-- 1 krishna users 0 2010-03-09 11:42 today.sh~ 9


by executing lines of my script....

ls -l > temp
awk '{print $ $NF,length($NF)}' temp
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to Find file size

Hi, I am writing a script which takes the input file name and concat as a new file by appending a "1" to the file name. However i am not able to get the size of this new file. I am not sure where i am going wrong. Please check the script and help me get this working. #!/bin/sh ... (1 Reply)
Discussion started by: ragsnovel
1 Replies

2. Shell Programming and Scripting

help removing characters for output file in shell script

hi i'm new to shell scripts and have a small problem i am running a batch converter that returns all flash .flv files in a directory and create a png image from each one the problem i have is the $1 variable , its ok on the first call but on the secound call $1.png , i have extra... (1 Reply)
Discussion started by: wingchun22
1 Replies

3. Shell Programming and Scripting

Bold characters in a file using Shell script

Hi, When I am running below mentioned script then the characters become bold but after opening the same file in Windows, Instead of getting bold characters i am getting some garbage value for \033Kunal Dixit Output in Windows (after ftp the file): but in windows , i am getting My name is... (0 Replies)
Discussion started by: kunal_dixit
0 Replies

4. Shell Programming and Scripting

writing shell script to find line of invalid characters

Hi, I have to write s script to check an input file for invalid characters. In this script I have to find the exact line of the invalid character. If the input file contain 2 invalid character sat line 10 and 17, the script will show the value 10 and 17. Any help is appreciated. (3 Replies)
Discussion started by: beginner82
3 Replies

5. Shell Programming and Scripting

How to find yesterdays file - shell script

Hey guys - i have a script (below) that searches for current files in a particular directory. However i was wondering how to make it search for "yesterdays" file. For instance it looks for a file from yesterday and no older than that. I used stat command to check for file information: ... (6 Replies)
Discussion started by: DallasT
6 Replies

6. Shell Programming and Scripting

Shell Script Find in File

Right, noob to shell scripting, playing a round for practice, wrote the following but it doesn't seem to work as expected, how could I fix/improve this script? #!/bin/bash #set -v #set -x case $# in 1) echo Searching for $1 in '*'; find . -iname '*' 2>/dev/null | xargs grep "$1" -sl... (3 Replies)
Discussion started by: Pezmc
3 Replies

7. UNIX for Dummies Questions & Answers

Shell script find word from one file and insert in another file

Hi, I am new to shell scripting. I need a bash shell scripts which search and grep a parameter value from input.txt file and insert it in between two semicolon of second line of output.txt file. For example The shell script search an IP address as parameter value from input.txt ... (2 Replies)
Discussion started by: sunilkumarsinha
2 Replies

8. Shell Programming and Scripting

share a shell script which can replace weird characters in directory or file name

I just finish the shell script . This shell can replace weird characters (such as #$%^@!'"...) in file or directory name by "_" I spent long time on replacing apostrophe in file/directory name added: 2012-03-14 the 124th line (/usr/bin/perl -i -e "s#\'#\\'#g" /tmp/rpdir_level$i.tmp) is... (5 Replies)
Discussion started by: begonia
5 Replies

9. UNIX for Dummies Questions & Answers

Find error in the shell script file

echo "******Select Option:******" echo "1 - script1" echo "2 - script2" echo "3 - script3 " read option echo "You have selected" $option"." if then /scratch/username/script1.sh elif then /scratch/username/script2.sh elif then /scratch/username/script3.sh else echo "Please try again... (12 Replies)
Discussion started by: Dish
12 Replies

10. Homework & Coursework Questions

Shell script to find file type

1. The problem statement, all variables and given/known data: Write a shell script that takes a single command line parameter, a file path (might be relative or absolute). The script should examine that file and print a single line consisting of the phrase: Windows ASCII if the files is an... (4 Replies)
Discussion started by: kwatt019
4 Replies
ALTER 
GROUP(7) SQL Commands ALTER GROUP(7) NAME
ALTER GROUP - change role name or membership SYNOPSIS
ALTER GROUP groupname ADD USER username [, ... ] ALTER GROUP groupname DROP USER username [, ... ] ALTER GROUP groupname RENAME TO newname DESCRIPTION
ALTER GROUP changes the attributes of a user group. This is an obsolete command, though still accepted for backwards compatibility, because groups (and users too) have been superseded by the more general concept of roles. The first two variants add users to a group or remove them from a group. (Any role can play the part of either a ``user'' or a ``group'' for this purpose.) These variants are effectively equivalent to granting or revoking membership in the role named as the ``group''; so the preferred way to do this is to use GRANT [grant(7)] or REVOKE [revoke(7)]. The third variant changes the name of the group. This is exactly equivalent to renaming the role with ALTER ROLE [alter_role(7)]. PARAMETERS
groupname The name of the group (role) to modify. username Users (roles) that are to be added to or removed from the group. The users must already exist; ALTER GROUP does not create or drop users. newname The new name of the group. EXAMPLES
Add users to a group: ALTER GROUP staff ADD USER karl, john; Remove a user from a group: ALTER GROUP workers DROP USER beth; COMPATIBILITY
There is no ALTER GROUP statement in the SQL standard. SEE ALSO
GRANT [grant(7)], REVOKE [revoke(7)], ALTER ROLE [alter_role(7)] SQL - Language Statements 2010-05-14 ALTER GROUP(7)
All times are GMT -4. The time now is 08:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy