Am a Beginner to shell scripting, so please pardon my question.
Below is the file format of file a.txt
a.txt
In the above file format, i have record count of total no of records excluding the header file here 3 , this varies depending upon the no of records in the file.
I am using the below in command mode .
and am getting the output correctly which is 3.
How ever when i put the same above command in shell script, am not getting the correct answer .
Below is the script
Am getting the variable count displayed as $'3\r' , Can anyone please help me if am missing something here obvious.
I cant process the downstream program, because of this issue.
Thanks for looking into the issue.
Last edited by Franklin52; 05-11-2011 at 03:43 AM..
Reason: Please use code tags
How can I cut the date and leave it in 3 variable?
date="20181219"
year=substr(date,1,4)
monthsubstr(date,4,2)
daysubstr(date,6,2)
result
year=2018
month=12
day=19
this does not work for me (3 Replies)
I am using : << cut / cut to comment out block of code.
Works fine on few lines of script, then it gives me this cryptic error when I try to comment out about 80 lines.
The "warning " is at last line of script.
done < results
169 echo "END read all positioning parameters"
170... (8 Replies)
I am writing a shell script to skip couple of feilds in a flat file and as a part of this I have written the below piece of code in it.
cut -d '|' -f 1-17,19-31 $1 > filename
To add pipe at end of the line I used below command, but it adds even to header and footer as well which i... (11 Replies)
Guys,
I have a requirement as below.
consider,if i use df command, its getting the below output.
file system kbytes used avail %used Mounted on
/dev/sample/ 45765 40000 5765 50% /
/dev/filesys/ 30000 20000 1000 80% /u
....
....
Now i wanted to cut the /u... (11 Replies)
Hi,
I need to just cut the location of file and give it as input to the other command. For example:
ct lsview | grep kavya-
* kavya-telecom-view /first/nso01/disk2/views/kavya-telecom-view.vws
I need only the location like /first/nso01/disk2/views/kavya-telecom-view.vws.How to cut that... (4 Replies)
I have installed my flash application using shell script. I have created short cut to desktop. Now i want to change the default short cut Icon. Please tell me script to change the short cut icon.
---------- Post updated at 12:54 AM ---------- Previous update was at 12:33 AM ----------
Working... (0 Replies)
I'm new to shell programming, and am having a problem in a (Korn) shell program, which boils down to this:
The program reads a record from an input file and then uses a series of
"cut" commands to break the record into parts and assign the parts to
variables. There are no delimiters in the... (2 Replies)
Hello All,,
I'm very new to Unix and I'm more in SAP ABAP. I have a requirement for a shell script which will accept one parameter as Input file name(with directory)
e.g : /sapdata/deubank/dbdirect/out/deu01deupe/in/deu01deupe20051207111320.pmt
In the shell script I have to make two more... (2 Replies)
I have a string "\/scratch\/databases\". I want
to have a new string "\/scratch\/databases" by cutting last '\' character using shell script. I can't do this
Please help me.
Thanks in advance
ThuongTranVN (4 Replies)