11-20-2009
Replace string in unix from 10th column onwards
Hi All,
I need to replace the last 19 bytes of the following string
My_Org_Testing_20090102_231124.txt (Text_Date_Time.txt).
I would like to derive the current time using "date +%Y%m%d_%H%M%S.txt" and replace the last 19 bytes of the above string
I would appreciate if someone could help me on this.
Thanks in advance
Regards,
Rohan
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Can any one tell me how to replace the 10th column in a file(comma delimted) with a new file with a single column. Can any one Help me out of the please as soon as possible as i am in a terribley hurry!!!!!!
Many THanks, (2 Replies)
Discussion started by: ahmedwaseem2000
2 Replies
2. Shell Programming and Scripting
Hello,
I need some help ....i have a file with many number of fields i want to replace the 10th field of the file by number 2 .Also the delimeter of the file is | .
Pls suggest and help..
Regards, (2 Replies)
Discussion started by: PradeepRed
2 Replies
3. UNIX for Advanced & Expert Users
Hi,
I want to replace string in column,Example i have file caleed a1.txt ,want to replace string "A12" with "A23" only in column2 ,not from file itself.Using sed command replace string in file itself.
Thanks,
Mohan (3 Replies)
Discussion started by: mohan705
3 Replies
4. Shell Programming and Scripting
I have a file like below
10 10 21 32 43 54
20 10 25 36 47 58
30 19 20 31 42 53
40 10 24 35 46 57
50 10 28 39 40 51
I need to check if $1 <= 40, then print from $2 onwards.
If $1 > 40, the line is not printed.
So I would have an output like this
10 21 32 43 54
10 25 36 47... (10 Replies)
Discussion started by: kristinu
10 Replies
5. UNIX for Dummies Questions & Answers
I have file with multiple columns. Column values for a record may be same.
Now i have to replace a column value(this can be same for the other columns) with new value.
File.txt
A,B,C,D,A,B,C,D,A,B,C,D
A,B,C,D,A,B,C,D,A,B,C,D
A,B,C,D,A,B,C,D,A,B,C,D
A,B,C,D,A,B,C,D,A,B,C,D... (1 Reply)
Discussion started by: ksailesh
1 Replies
6. Shell Programming and Scripting
Hi
I would like to replace empty string with a particluar value, any suggessions with awk ?
my input file is not delimited with any delimiters
input
52001073M8000000004567777
5200107 000000004567778
5200107 000000004567779
52001073M8000000004567789
Expected output... (5 Replies)
Discussion started by: selvankj
5 Replies
7. Shell Programming and Scripting
how to replace the 10th colum? Each line begins similarly, but they all ends variously.
Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15,Col16,Col17
2015/03/14 15:00:04,2015/03/14 15:00:04,0,Server05,Omega-God,Beta_G,101011247,1,1,24,7,0,,339083645,1,1,... (9 Replies)
Discussion started by: ooilinlove
9 Replies
8. Shell Programming and Scripting
I wanted to search for a string and replace it with other string from nth column of a file which is comma seperated which I am able to do with below
# For Comma seperated file without quotes
awk 'BEGIN{OFS=FS=","}$"'"$ColumnNo"'"=="'"$PPK"'"{$"'"$ColumnNo"'"="'"$NPK"'"}{print}' ${FileName} ... (5 Replies)
Discussion started by: Amit Joshi
5 Replies
9. Shell Programming and Scripting
Hi Experts,
I created a powershell script to fetch user details from active directory and export it to a csv/excel.
"abc","bcd","devloper;admin"
"bcd","dca","tester;QA;admin"
So here user abc is member of devloper and admin group and user bcd is a member of tester,QA and admin... (6 Replies)
Discussion started by: shekhar_4_u
6 Replies
10. UNIX for Beginners Questions & Answers
I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this.
string(Scenario 1)- user::r--,user::ourfrd:r--
String(Scenario 2)- user::r--
File
****
# file: /local/Desktop/myfile
# owner: me
# group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
VFPRINTF(3) 1 VFPRINTF(3)
vfprintf - Write a formatted string to a stream
SYNOPSIS
int vfprintf (resource $handle, string $format, array $args)
DESCRIPTION
Write a string produced according to $format to the stream resource specified by $handle.
Operates as fprintf(3) but accepts an array of arguments, rather than a variable number of arguments.
PARAMETERS
o $handle
-
o $format
- See sprintf(3) for a description of $format.
o $args
-
RETURN VALUES
Returns the length of the outputted string.
EXAMPLES
Example #1
vfprintf(3): zero-padded integers
<?php
if (!($fp = fopen('date.txt', 'w')))
return;
vfprintf($fp, "%04d-%02d-%02d", array($year, $month, $day));
// will write the formatted ISO date to date.txt
?>
SEE ALSO
printf(3), sprintf(3), sscanf(3), fscanf(3), vsprintf(3), number_format(3).
PHP Documentation Group VFPRINTF(3)