Search Results

Search: Posts Made By: siteregsam
1,024
Posted By siteregsam
Is it possible to introduce a character using sed?
I need to reformat a text using sed command like

Text: 160845
Output: 16:08:45

Please help me how this can be done using sed.
Thanks in adv
2,878
Posted By siteregsam
SQL one liner for subtracting 1 from date
I got a statement like below to subtract 1 from given date using teradata. I am looking for a one line unix command to perform the same.

select 'parse_this_record', (DATE '${FILE_DATE}' - 1)...
1,554
Posted By siteregsam
Tweaking the output of diff
hello everyone,

I am trying to compare two files and have the result in a new files. When I used diff I am getting the header, '<' and '>' in my result which I don't want to have it in my output...
12,987
Posted By siteregsam
@pludi: Now i got what happened. Thanks for the...
@pludi: Now i got what happened. Thanks for the insight :)
12,987
Posted By siteregsam
Problem with mv command
I was trying to move a file to a particular directory. In a hurry i forgot to give the dest directory, as below




mv prod.log


The file disappeared. :confused:
Any idea where it...
1,076
Posted By siteregsam
URGENT HELP: problem with mv command
I was trying to move a file to a particular directory. In a hurry i forgot to give the dest directory, as below


mv prod.log


The file disappeared. :confused:
Any idea where it might...
4,771
Posted By siteregsam
how to assign file names to array variable?
I wish to assign file names with particular extention to array variables. For example if there are 5 files with .dat extention in /home/sam then i have to assign these 5 files to an array.

plz...
3,605
Posted By siteregsam
Thanks to all... I made a silly mistake in...
Thanks to all...

I made a silly mistake in the command. I had wrongly specified the field position as 6 instead of 7 in awk :(

After correcting it, the command worked.
Sorry for the...
3,605
Posted By siteregsam
Hi Kalai.. I need the field(file name) next to...
Hi Kalai..
I need the field(file name) next to CF, for example TVLI_STATS_NRT_XLSTWS03_20120212_224550.csv|

For me the command didn't worked. Could u plz post the command u tried...
3,605
Posted By siteregsam
piping from grep to awk without intermediate files
I am trying to extract the file names alone, for example "TVLI_STATS_NRT_XLSTWS03_20120215_132629.csv", from below output
which was given by the grep.

sam:/data/log: grep...
1,995
Posted By siteregsam
I tried assigning the file names to a variable as...
I tried assigning the file names to a variable as below but facing issues with awk syntax


sam:/data/input: awk -v fn=$fn -v bd_file=$bd_file -F"|" '{if(NF!=14)print >> bd_file;else print >>...
1,995
Posted By siteregsam
When I hardcode the file name inside double...
When I hardcode the file name inside double quotes, say "bad_file.txt", as below nawk works fine.
nawk -F"|" '{if(NF!=14){printf("%s\n",$0) >> "bad_file.txt"} else {printf("%s\n",$0) >>...
1,995
Posted By siteregsam
Thanks Peasant... I tried above but it worked...
Thanks Peasant...
I tried above but it worked :(


sam:/data/input: nawk -v fn=$fn -F"|" '{if(NF!=14){printf("%s\n",$0) >> fn"_bad_data"}else{printf("%s\n",$0) >> fn }}' $fn.orig

nawk:...
1,995
Posted By siteregsam
problem in redirecting records using nawk
I am trying to redirect record to two files using nawk if-else.


#Identify good and bad records and redirect records using if-then-else
nawk -F"|" '{if(NF!=14){printf("%s\n",$0) >>...
1,962
Posted By siteregsam
worked fine... thanks guruprasadpr
worked fine... thanks guruprasadpr
1,962
Posted By siteregsam
When I tried the above command i got ...
When I tried the above command i got



Any idea why???
1,962
Posted By siteregsam
how to remove particular records from a file???
I need to remove header(H) and trailer(T) from a file keeping other records as such.

The source file will look as below



I have to remove
H|20120203_000500|20120203_000500 and
T|...
1,961
Posted By siteregsam
I am trying to count the records in a file having...
I am trying to count the records in a file having '|' in it.
The source file will look as below



Expected output : 4

Sorry for not conveying the requirement properly before :(
1,961
Posted By siteregsam
Thanks balajesuri... But I want that count to...
Thanks balajesuri...
But I want that count to be assigned to a variable.
Please show me how to do show....

---------- Post updated at 10:57 PM ---------- Previous update was at 10:53 PM...
1,961
Posted By siteregsam
counting particular record format in a file using AWK
I am trying to count records of particular format from a file and assign it to a variable. I tried below command


br_count=wc -l "inputfile.dat"| awk -F"|" '{if (NF != "14") print }'


but...
7,845
Posted By siteregsam
redirecting output using if-then-else in awk
I am trying to filter records based on number of "|", delimiter in my application. If number of "|" is greater than 14 its a bad record, else its a good record. I have to redirect output to two...
2,226
Posted By siteregsam
appending text to a file
I am trying to count number of record in a file and then append a trailer to that file.

Trailer should e in the format as below
T| <count of records>

count of records ---> this count...
1,913
Posted By siteregsam
@@balajesuri: Sorry yaar, I used ls -ltr, so it...
@@balajesuri: Sorry yaar, I used ls -ltr, so it listed as below


$ ls -1t input_*.dat
input_20111224.dat
input_20111230.dat
1,913
Posted By siteregsam
By the way someone help me as how to extract only...
By the way someone help me as how to extract only the file name(input_20111230.dat) from the ls -ltr command output.

sam:/top/work/data/input:ls -ltr input_*.dat | tail -1
-rw-r--r-- 1 work...
1,913
Posted By siteregsam
Thanks balajesuri... From my analysis i...
Thanks balajesuri...

From my analysis i guess, ls -ltr command list files such that recently created file gets listed at the end.
For example, input_20111230.dat ----> file created on 30 Dec
...
Showing results 1 to 25 of 26

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