# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/(?<=(\\/\\/\[JsonProperty\(Required = Required\.Always\)]\n)|(\\/\\/\[JsonProperty\(DefaultValueHandling = DefaultValueHandling\.Ignore\)]\n))( public [a-zA-Z]+ )/ [JsonPropertyName("")]\n$0/gm;t' <<< "namespace Telegram.Bot.Types.Payments
{
/// <summary>
/// This object contains information about an incoming pre-checkout query
/// </summary>
//[JsonObject(MemberSerialization.OptIn, NamingStrategyType = typeof(SnakeCaseNamingStrategy))]
public sealed record PreCheckoutQuery
{
/// <summary>
/// Unique query identifier
/// </summary>
//[JsonProperty(Required = Required.Always)]
public string Id { get; set; }
/// <summary>
/// User who sent the query
/// </summary>
//[JsonProperty(Required = Required.Always)]
public User From { get; set; }
/// <summary>
/// Three-letter ISO 4217 currency code
/// </summary>
//[JsonProperty(Required = Required.Always)]
public string Currency { get; set; }
/// <summary>
/// Total price in the smallest units of the currency.
/// </summary>
//[JsonProperty(Required = Required.Always)]
public int TotalAmount { get; set; }
/// <summary>
/// Bot specified invoice payload
/// </summary>
//[JsonProperty(Required = Required.Always)]
public string InvoicePayload { get; set; }
/// <summary>
/// Optional. Identifier of the shipping option chosen by the user
/// </summary>
//[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ShippingOptionId { get; set; }
/// <summary>
/// Optional. Order info provided by the user
/// </summary>
//[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public OrderInfo OrderInfo { get; set; }
}
}
"
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html