Search Results

Search: Posts Made By: Amrutha24
15,384
Posted By Amrutha24
Length of a fixed width file
I have a fixed width file of length 53. when is try to get the lengh of the record of that file i get 2 different answers.


awk '{print length;exit}' <File_name>


The above code gives me...
1,828
Posted By Amrutha24
I pass a file as Input, read line by line and...
I pass a file as Input, read line by line and check for the length of a record using wc -c command. ex: 250.

If the record is less than the given length the script fails.

If all the records in...
1,828
Posted By Amrutha24
Sorry i used wc -c but if the record contains \...
Sorry i used wc -c but if the record contains \ it gives 1 less than the actual record length.
1,828
Posted By Amrutha24
Record length check fails due to '\' character
When I check the length for the records in the file, it does not give me the correct value. I used wc -l command.

Example records:

abcdefghij
abcd\efghij
abcdefghi

Expected output is:
10...
1,228
Posted By Amrutha24
Both the soultion worked fine.. Thank you.. :) :)
Both the soultion worked fine.. Thank you.. :) :)
1,228
Posted By Amrutha24
Need to call a shell script within another shell script
I have two shell script one.sh and two.sh.

I want to call the script two.sh within in the script one.sh

I did the below way,


one.sh

echo "JOB STARTED"
echo "JOB START TIME: `date...
13,660
Posted By Amrutha24
Adding end of line character in the last record
Thanks for both. Its is workinf fine.
13,660
Posted By Amrutha24
Adding end of line character in the last record
Need to add end of line character to last record in a fixed width file.

When i take the record length of each line, for all the records it gives example like 200 except the last line as 199.
...
4,401
Posted By Amrutha24
The command is working fine but when i redirect...
The command is working fine but when i redirect the output to a file at the actual end of record i am able to see Control M(^M) charater.


awk 'NR==FNR{if(length($0) >...
4,401
Posted By Amrutha24
Remove new line character and add space to convert into fixed width file
I have a file with different record length. The file as to be converted into fixed length by appending spaces at the end of record. The length should be calculated based on the record with maximum...
5,796
Posted By Amrutha24
The below code do not appened spaces as many as...
The below code do not appened spaces as many as my required length. When i gave length as 285, it append spaces upto 251 only. When i use printf command it shows 285.

But when i write the output...
7,305
Posted By Amrutha24
#!/bin/ksh FILE=$1 LEN=$2 echo | awk -v...
#!/bin/ksh
FILE=$1
LEN=$2
echo | awk -v l="$LEN" -v file="$FILE" '{s="%-"l"s\n";printf(s,$0);}' file > temp1.txt;


I execte the script using the below command


sh -x Script.sh...
7,305
Posted By Amrutha24
The parameters i need to pass are FILE =...
The parameters i need to pass are

FILE = <filepath>/partial.txt

When i replace the filepath it gives error as "cannot open the file for reading"
7,305
Posted By Amrutha24
Pass Parameters to awk command
I need to pass values at runtime for the below awk command where

l is the length and partial.txt is the file name.


awk -v l=285 '{s="%-"l"s\n";printf(s,$0);}' partial.txt > temp1.txt;
5,796
Posted By Amrutha24
I need to pass the values as external parameters,...
I need to pass the values as external parameters, i.e., at runtime i want pass the values.
5,796
Posted By Amrutha24
I need to pass the length and file name as...
I need to pass the length and file name as parameters. Please help how to change the below code as per that,


awk -v l="15" '{s="%-"l"s\n";printf(s,$0);}' file > temp;
5,796
Posted By Amrutha24
Append spaces the rows to make it into a required fixed length file
I want to make a script to read row by row and find its length. If the length is less than my required length then i hav to append spaces to that paritucular row. Each row contains special...
Showing results 1 to 17 of 17

 
All times are GMT -4. The time now is 10:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy